public class PresetSequenceClassifier<IN extends CoreMap> extends AbstractSequenceClassifier<IN>
classIndex, featureFactories, flags, knownLCWords, pad, windowSize
Constructor and Description |
---|
PresetSequenceClassifier(java.util.Properties props) |
Modifier and Type | Method and Description |
---|---|
java.util.List<IN> |
classify(java.util.List<IN> document)
Classify a
List of something that extendsCoreMap . |
java.util.List<IN> |
classifyWithGlobalInformation(java.util.List<IN> tokenSeq,
CoreMap doc,
CoreMap sent)
Classify a
List of something that extends CoreMap using as
additional information whatever is stored in the document and sentence. |
void |
loadClassifier(java.io.ObjectInputStream ois,
java.util.Properties props)
Load a classifier from the specified input stream.
|
void |
serializeClassifier(java.io.ObjectOutputStream oos)
Serialize a sequence classifier to an object output stream
|
void |
serializeClassifier(java.lang.String serializePath)
Serialize a sequence classifier to a file on the given path.
|
void |
train(java.util.Collection<java.util.List<IN>> objectBankWrapper,
DocumentReaderAndWriter<IN> readerAndWriter)
Trains a classifier from a Collection of sequences.
|
apply, backgroundSymbol, classify, classifyAndWriteAnswers, classifyAndWriteAnswers, classifyAndWriteAnswers, classifyAndWriteAnswers, classifyAndWriteAnswers, classifyAndWriteAnswers, classifyAndWriteAnswers, classifyAndWriteAnswersKBest, classifyAndWriteAnswersKBest, classifyAndWriteViterbiSearchGraph, classifyFile, classifyFilesAndWriteAnswers, classifyFilesAndWriteAnswers, classifyKBest, classifyRaw, classifySentence, classifySentenceWithGlobalInformation, classifyStdin, classifyStdin, classifyToCharacterOffsets, classifyToString, classifyToString, classifyWithInlineXML, countResults, countResultsSegmenter, defaultReaderAndWriter, dumpFeatures, finalizeClassification, getKnownLCWords, getSampler, getSequenceModel, labels, loadClassifier, loadClassifier, loadClassifier, loadClassifier, loadClassifier, loadClassifier, loadClassifierNoExceptions, loadClassifierNoExceptions, loadClassifierNoExceptions, loadClassifierNoExceptions, loadClassifierNoExceptions, makeObjectBankFromFile, makeObjectBankFromFile, makeObjectBankFromFiles, makeObjectBankFromFiles, makeObjectBankFromFiles, makeObjectBankFromReader, makeObjectBankFromString, makePlainTextReaderAndWriter, makePlainTextReaderAndWriter, makeReaderAndWriter, plainTextReaderAndWriter, printFeatureLists, printFeatures, printProbs, printProbs, printProbsDocument, printProbsDocuments, printResults, reinit, segmentString, segmentString, train, train, train, train, train, train, windowSize, writeAnswers
public PresetSequenceClassifier(java.util.Properties props)
public void serializeClassifier(java.lang.String serializePath)
serializeClassifier
in class AbstractSequenceClassifier<IN extends CoreMap>
serializePath
- The path/filename to write the classifier to.public void serializeClassifier(java.io.ObjectOutputStream oos)
serializeClassifier
in class AbstractSequenceClassifier<IN extends CoreMap>
public void loadClassifier(java.io.ObjectInputStream ois, java.util.Properties props)
loadClassifier
in class AbstractSequenceClassifier<IN extends CoreMap>
ois
- The InputStream to load the serialized classifier fromprops
- This Properties object will be used to update the
SeqClassifierFlags which are read from the serialized classifierpublic java.util.List<IN> classify(java.util.List<IN> document)
AbstractSequenceClassifier
List
of something that extendsCoreMap
.
The classifications are added in place to the items of the document,
which is also returned by this method.
Warning: In many circumstances, you should not call this method directly.
In particular, if you call this method directly, your document will not be preprocessed
to add things like word distributional similarity class or word shape features that your
classifier may rely on to work correctly. In such cases, you should call
classifySentence
instead.classify
in class AbstractSequenceClassifier<IN extends CoreMap>
document
- A List
of something that extends CoreMap
.List
, but with the elements annotated with their
answers (stored under the
CoreAnnotations.AnswerAnnotation
key). The answers will be the class labels defined by the CRF
Classifier. They might be things like entity labels (in BIO
notation or not) or something like "1" vs. "0" on whether to
begin a new token here or not (in word segmentation).public java.util.List<IN> classifyWithGlobalInformation(java.util.List<IN> tokenSeq, CoreMap doc, CoreMap sent)
AbstractSequenceClassifier
List
of something that extends CoreMap
using as
additional information whatever is stored in the document and sentence.
This is needed for SUTime (NumberSequenceClassifier), which requires
the document date to resolve relative dates.classifyWithGlobalInformation
in class AbstractSequenceClassifier<IN extends CoreMap>
tokenSeq
- A List
of something that extends CoreMap
public void train(java.util.Collection<java.util.List<IN>> objectBankWrapper, DocumentReaderAndWriter<IN> readerAndWriter)
train
in class AbstractSequenceClassifier<IN extends CoreMap>
objectBankWrapper
- An ObjectBank or a collection of sequences of INreaderAndWriter
- A DocumentReaderAndWriter to use when loading test files