|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.ConfigurableProcessor
de.fu_berlin.ties.CollectingProcessor
de.fu_berlin.ties.classify.TextFilter
public class TextFilter
A text filter provides a simple API for classifying text files. All instances
of this class share a common
TrainableClassifier
which will be
initialized by the first created instance. This class it meant to be
used with NailGun to
avoid the cost of creating the virtual machine and to allow re-using the
same classifier instance between multiple calls.
The classifier is configured from the provided
configuration, using the
ClassTrain.CONFIG_SUFFIX_TEXT
suffix
to allow text-specific settings. The classes to consider for classification
are read from the CONFIG_CLASSES
parameter.
The probability of the very first class will be returned as "score".
This class is meant to be invoked on the command line as "filter" goal to classify or train a text file. It supports two commands, "classify" and "train":
System.out
:Additional parameters after the required arguments are allowed but ignored; other commands will be treated as errors.
Field Summary | |
---|---|
static String |
CONFIG_CLASSES
Configuration key: Names of the classes used to filter text. |
Constructor Summary | |
---|---|
TextFilter()
Creates a new instance, configured from the default configuration. |
|
TextFilter(TiesConfiguration conf)
Creates a new instance. |
Method Summary | |
---|---|
void |
process(List<String> collected,
ContextMap context)
Processes the collected input arguments. |
String |
toString()
Returns a string representation of this object. |
Methods inherited from class de.fu_berlin.ties.CollectingProcessor |
---|
close, process |
Methods inherited from class de.fu_berlin.ties.ConfigurableProcessor |
---|
getConfig |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String CONFIG_CLASSES
Constructor Detail |
---|
public TextFilter() throws ProcessingException
ProcessingException
- if the configured classifier instance cannot
be instantiatedpublic TextFilter(TiesConfiguration conf) throws ProcessingException
conf
- used to configure this instance
ProcessingException
- if the configured classifier instance cannot
be instantiatedMethod Detail |
---|
public void process(List<String> collected, ContextMap context) throws IOException, ProcessingException
process
in class CollectingProcessor
collected
- a list of Strings containing the collected input
argumentscontext
- a map of objects that are made available for processing;
will be empty when called from the CollectingProcessor.close(int)
method in this
class
IOException
- if an I/O error occurs
ProcessingException
- if an error occurs during processingpublic String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |