public class NumberSequenceClassifier extends AbstractSequenceClassifier<CoreLabel>
Modifier and Type | Field and Description |
---|---|
static java.util.regex.Pattern |
ARMY_TIME_MORNING |
static java.util.regex.Pattern |
CURRENCY_SYMBOL_PATTERN |
static java.util.regex.Pattern |
CURRENCY_WORD_PATTERN |
static java.util.regex.Pattern |
GENERIC_TIME_WORDS |
static java.util.regex.Pattern |
ORDINAL_PATTERN |
static java.util.regex.Pattern |
PERCENT_SYMBOL_PATTERN |
static java.util.regex.Pattern |
PERCENT_WORD_PATTERN |
static java.lang.String |
SUTIME_PROPERTY |
static boolean |
USE_SUTIME_DEFAULT |
static java.lang.String |
USE_SUTIME_PROPERTY |
static java.lang.String |
USE_SUTIME_PROPERTY_BASE |
classIndex, featureFactories, flags, knownLCWords, pad, windowSize
Constructor and Description |
---|
NumberSequenceClassifier() |
NumberSequenceClassifier(boolean useSUTime) |
NumberSequenceClassifier(java.util.Properties props,
boolean useSUTime,
java.util.Properties sutimeProps) |
Modifier and Type | Method and Description |
---|---|
static CoreMap |
alignSentence(CoreMap sentence)
Copies one sentence replicating only information necessary for SUTime
|
java.util.List<CoreLabel> |
classify(java.util.List<CoreLabel> document)
Classify a
List of CoreLabel s. |
java.util.List<CoreLabel> |
classifyWithGlobalInformation(java.util.List<CoreLabel> tokens,
CoreMap document,
CoreMap sentence)
Classify a
List of something that extends CoreMap using as
additional information whatever is stored in the document and sentence. |
static java.util.List<CoreLabel> |
copyTokens(java.util.List<CoreLabel> srcTokens,
CoreMap srcSentence)
Create a copy of srcTokens, detecting on the fly if character offsets need adjusting
|
void |
finalizeClassification(CoreMap document)
Classification is finished for the document.
|
void |
loadClassifier(java.io.ObjectInputStream in,
java.util.Properties props)
Load a classifier from the specified input stream.
|
static void |
main(java.lang.String[] args) |
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<CoreLabel>> docs,
DocumentReaderAndWriter<CoreLabel> readerAndWriter)
Trains a classifier from a Collection of sequences.
|
static void |
transferAnnotations(CoreLabel src,
CoreLabel dst)
Transfer from src to dst all annotations generated bu SUTime and NumberNormalizer
|
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, 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 static final boolean USE_SUTIME_DEFAULT
public static final java.lang.String USE_SUTIME_PROPERTY
public static final java.lang.String USE_SUTIME_PROPERTY_BASE
public static final java.lang.String SUTIME_PROPERTY
public static final java.util.regex.Pattern CURRENCY_WORD_PATTERN
public static final java.util.regex.Pattern CURRENCY_SYMBOL_PATTERN
public static final java.util.regex.Pattern ORDINAL_PATTERN
public static final java.util.regex.Pattern ARMY_TIME_MORNING
public static final java.util.regex.Pattern GENERIC_TIME_WORDS
public static final java.util.regex.Pattern PERCENT_WORD_PATTERN
public static final java.util.regex.Pattern PERCENT_SYMBOL_PATTERN
public NumberSequenceClassifier()
public NumberSequenceClassifier(boolean useSUTime)
public NumberSequenceClassifier(java.util.Properties props, boolean useSUTime, java.util.Properties sutimeProps)
public java.util.List<CoreLabel> classify(java.util.List<CoreLabel> document)
List
of CoreLabel
s.classify
in class AbstractSequenceClassifier<CoreLabel>
document
- A List
of CoreLabel
s.List
, but with the elements annotated
with their answers.public java.util.List<CoreLabel> classifyWithGlobalInformation(java.util.List<CoreLabel> tokens, CoreMap document, CoreMap sentence)
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<CoreLabel>
tokens
- A List
of something that extends CoreMap
public void finalizeClassification(CoreMap document)
AbstractSequenceClassifier
finalizeClassification
in class AbstractSequenceClassifier<CoreLabel>
public static CoreMap alignSentence(CoreMap sentence)
sentence
- public static void transferAnnotations(CoreLabel src, CoreLabel dst)
src
- dst
- public static java.util.List<CoreLabel> copyTokens(java.util.List<CoreLabel> srcTokens, CoreMap srcSentence)
srcTokens
- srcSentence
- public void train(java.util.Collection<java.util.List<CoreLabel>> docs, DocumentReaderAndWriter<CoreLabel> readerAndWriter)
AbstractSequenceClassifier
train
in class AbstractSequenceClassifier<CoreLabel>
docs
- An ObjectBank or a collection of sequences of INreaderAndWriter
- A DocumentReaderAndWriter to use when loading test filespublic void serializeClassifier(java.lang.String serializePath)
AbstractSequenceClassifier
serializeClassifier
in class AbstractSequenceClassifier<CoreLabel>
serializePath
- The path/filename to write the classifier to.public void serializeClassifier(java.io.ObjectOutputStream oos)
AbstractSequenceClassifier
serializeClassifier
in class AbstractSequenceClassifier<CoreLabel>
public void loadClassifier(java.io.ObjectInputStream in, java.util.Properties props) throws java.io.IOException, java.lang.ClassCastException, java.lang.ClassNotFoundException
AbstractSequenceClassifier
loadClassifier
in class AbstractSequenceClassifier<CoreLabel>
in
- The InputStream to load the serialized classifier fromprops
- This Properties object will be used to update the
SeqClassifierFlags which are read from the serialized classifierjava.io.IOException
- If there are problems accessing the input streamjava.lang.ClassCastException
- If there are problems interpreting the serialized datajava.lang.ClassNotFoundException
- If there are problems interpreting the serialized datapublic static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception