|
Carrot2 v3.6.0-SNAPSHOT
API Documentation |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.carrot2.core.ProcessingResult
public final class ProcessingResult
Encapsulates the results of processing. Provides access to the values of attributes
collected after processing and utility methods for obtaining processed documents (
getDocuments())) and the created clusters (getClusters()).
| Method Summary | ||
|---|---|---|
static ProcessingResult |
deserialize(CharSequence input)
Deserialize from an input stream of characters. |
|
static ProcessingResult |
deserialize(InputStream input)
Deserializes a ProcessingResult from an XML stream. |
|
|
getAttribute(String key)
Returns a specific attribute of this result set. |
|
Map<String,Object> |
getAttributes()
Returns attributes fed-in and collected during processing. |
|
List<Cluster> |
getClusters()
Returns the clusters that have been created during processing. |
|
List<Document> |
getDocuments()
Returns the documents that have been processed. |
|
String |
serialize()
Serializes this ProcessingResult to an XML string. |
|
void |
serialize(OutputStream stream)
Serializes this ProcessingResult to an XML stream. |
|
void |
serialize(OutputStream stream,
boolean saveDocuments,
boolean saveClusters)
Serializes this ProcessingResult to a byte stream. |
|
void |
serialize(OutputStream stream,
boolean saveDocuments,
boolean saveClusters,
boolean saveOtherAttributes)
Serializes this ProcessingResult to a byte stream. |
|
void |
serializeJson(Writer writer)
Serializes this processing result as JSON to the provided writer. |
|
void |
serializeJson(Writer writer,
String callback)
Serializes this processing result as JSON to the provided writer. |
|
void |
serializeJson(Writer writer,
String callback,
boolean saveDocuments,
boolean saveClusters)
Serializes this processing result as JSON to the provided writer. |
|
void |
serializeJson(Writer writer,
String callback,
boolean indent,
boolean saveDocuments,
boolean saveClusters)
Serializes this processing result as JSON to the provided writer. |
|
void |
serializeJson(Writer writer,
String callback,
boolean indent,
boolean saveDocuments,
boolean saveClusters,
boolean saveOtherAttributes)
Serializes this processing result as JSON to the provided writer. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public Map<String,Object> getAttributes()
public <T> T getAttribute(String key)
getAttributes() and then getting the required attribute from the
map.
key - key of the attribute to return
public List<Document> getDocuments()
null if no documents are
present in the result.public List<Cluster> getClusters()
null if no clusters were
present in the result.public String serialize()
ProcessingResult to an XML string.
public void serialize(OutputStream stream)
throws Exception
ProcessingResult to an XML stream. The output includes all
documents, clusters and other attributes.
This method is not thread-safe, external synchronization must be applied if needed.
stream - the stream to serialize this ProcessingResult to. The stream
will not be closed.
Exception - in case of any problems with serialization
public void serialize(OutputStream stream,
boolean saveDocuments,
boolean saveClusters)
throws Exception
ProcessingResult to a byte stream. Documents and clusters
can be included or skipped in the output as requested. Other attributes are always
included.
This method is not thread-safe, external synchronization must be applied if needed.
stream - the stream to serialize this ProcessingResult to. The stream
will not be closed.saveDocuments - if false, documents will not be serialized.
Notice that when deserializing XML containing clusters but not
documents, document references in Cluster.getDocuments() will
not be restored.saveClusters - if false, clusters will not be serialized
Exception - in case of any problems with serialization
public void serialize(OutputStream stream,
boolean saveDocuments,
boolean saveClusters,
boolean saveOtherAttributes)
throws Exception
ProcessingResult to a byte stream. Documents, clusters and
other attributes can be included or skipped in the output as requested.
This method is not thread-safe, external synchronization must be applied if needed.
stream - the stream to serialize this ProcessingResult to. The stream
will not be closed.saveDocuments - if false, documents will not be serialized.
Notice that when deserializing XML containing clusters but not
documents, document references in Cluster.getDocuments() will
not be restored.saveClusters - if false, clusters will not be serializedsaveOtherAttributes - if false, other attributes will not be
serialized
Exception - in case of any problems with serialization
public static ProcessingResult deserialize(CharSequence input)
throws Exception
Exception
public static ProcessingResult deserialize(InputStream input)
throws Exception
ProcessingResult from an XML stream.
input - the input XML stream to deserialize a ProcessingResult from.
The stream will not be closed.
ProcessingResult
Exception - is case of any problems with deserialization
public void serializeJson(Writer writer)
throws IOException
writer. The
output includes all documents, clusters and other attributes.
This method is not thread-safe, external synchronization must be applied if needed.
writer - the writer to serialize this processing result to. The writer will
not be closed.
IOException - in case of any problems with serialization
public void serializeJson(Writer writer,
String callback)
throws IOException
writer. The
output includes all documents, clusters and other attributes.
This method is not thread-safe, external synchronization must be applied if needed.
writer - the writer to serialize this processing result to. The writer will
not be closed.callback - JavaScript function name in which to wrap the JSON response or
null.
IOException - in case of any problems with serialization
public void serializeJson(Writer writer,
String callback,
boolean saveDocuments,
boolean saveClusters)
throws IOException
writer.
Documents and clusters can be included or skipped in the output as requested. Other
attributes are always included.
This method is not thread-safe, external synchronization must be applied if needed.
writer - the writer to serialize this processing result to. The writer will
not be closed.callback - JavaScript function name in which to wrap the JSON response or
null.saveDocuments - if false, documents will not be serialized.saveClusters - if false, clusters will not be serialized
IOException - in case of any problems with serialization
public void serializeJson(Writer writer,
String callback,
boolean indent,
boolean saveDocuments,
boolean saveClusters)
throws IOException
writer.
This method is not thread-safe, external synchronization must be applied if needed.
writer - the writer to serialize this processing result to. The writer will
not be closed.callback - JavaScript function name in which to wrap the JSON response or
null.indent - if true, the output JSON will be pretty-printedsaveDocuments - if false, documents will not be serialized.saveClusters - if false, clusters will not be serialized
IOException - in case of any problems with serialization
public void serializeJson(Writer writer,
String callback,
boolean indent,
boolean saveDocuments,
boolean saveClusters,
boolean saveOtherAttributes)
throws IOException
writer.
Documents, clusters and other attributes can be included or skipped in the output
as requested.
writer - the writer to serialize this processing result to. The writer will
not be closed.callback - JavaScript function name in which to wrap the JSON response or
null.indent - if true, the output JSON will be pretty-printedsaveDocuments - if false, documents will not be serialized.saveClusters - if false, clusters will not be serializedsaveOtherAttributes - if false, other attributes will not be
serialized
IOException - in case of any problems with serialization
|
Please refer to project documentation at
http://project.carrot2.org |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||