Class AbstractAnnotator
- java.lang.Object
-
- io.outofprintmagazine.nlp.pipeline.annotators.AbstractAnnotator
-
- All Implemented Interfaces:
edu.stanford.nlp.pipeline.Annotator,IOOPAnnotator
- Direct Known Subclasses:
AbstractPosAnnotator,CharCountAnnotator,CoreNlpSentimentAnnotator,ParagraphCountAnnotator,QuotesAnnotator,SentenceCountAnnotator,SyllableCountAnnotator,TokenCountAnnotator,WordCountAnnotator
public abstract class AbstractAnnotator extends Object implements edu.stanford.nlp.pipeline.Annotator, IOOPAnnotator
Base class for all custom annotators.
constructor called once, conventionally constructs delegates for IScorer and ISerializer
init called once, with IParameterStore
once per document:
annotate(), conventionally implemented in the subclass
score(), delegated to an instance of IScorer
serialize(), delegated to instance of ISerializer
serializeAggregateDocument(), delegated to instance of ISerializer
- Author:
- Ram Sadasiv
- See Also:
IParameterStore,IScorer,ISerializer
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>dictionaryPOSprotected IParameterStoreparameterStoreprotected List<String>punctuationMarksprotected IScorerscorerprotected ISerializerserializer-
Fields inherited from interface edu.stanford.nlp.pipeline.Annotator
DEFAULT_REQUIREMENTS, STANFORD_CLEAN_XML, STANFORD_COLUMN_DATA_CLASSIFIER, STANFORD_COREF, STANFORD_COREF_MENTION, STANFORD_DEPENDENCIES, STANFORD_DETERMINISTIC_COREF, STANFORD_DOCDATE, STANFORD_ENTITY_MENTIONS, STANFORD_GENDER, STANFORD_KBP, STANFORD_LEMMA, STANFORD_LINK, STANFORD_MWT, STANFORD_NATLOG, STANFORD_NER, STANFORD_OPENIE, STANFORD_PARSE, STANFORD_POS, STANFORD_QUOTE, STANFORD_QUOTE_ATTRIBUTION, STANFORD_REGEXNER, STANFORD_RELATION, STANFORD_SENTIMENT, STANFORD_SSPLIT, STANFORD_TOKENIZE, STANFORD_TOKENSREGEX, STANFORD_TRUECASE, STANFORD_UD_FEATURES
-
-
Constructor Summary
Constructors Constructor Description AbstractAnnotator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddToScoreList(List<PhraseAnnotation> scoreMap, PhraseAnnotation p)voidaddToScoreMap(Map<String,BigDecimal> scoreMap, String key, BigDecimal score)abstract voidannotate(edu.stanford.nlp.pipeline.Annotation annotation)abstract ClassgetAnnotationClass()List<edu.stanford.nlp.ling.CoreLabel>getContextWords(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token)protected IParameterStoregetParameterStore()protected IScorergetScorer()protected ISerializergetSerializer()booleanhasPunctuationMark(edu.stanford.nlp.ling.CoreLabel token)voidinit(IParameterStore parameterStore)booleanisDictionaryWord(edu.stanford.nlp.ling.CoreLabel token)booleanisPunctuationMark(edu.stanford.nlp.ling.CoreLabel token)Set<Class<? extends edu.stanford.nlp.ling.CoreAnnotation>>requirementsSatisfied()abstract Set<Class<? extends edu.stanford.nlp.ling.CoreAnnotation>>requires()voidscore(edu.stanford.nlp.pipeline.CoreDocument document)voidserialize(edu.stanford.nlp.pipeline.CoreDocument document, com.fasterxml.jackson.databind.node.ObjectNode json)voidserializeAggregateDocument(edu.stanford.nlp.pipeline.CoreDocument document, com.fasterxml.jackson.databind.node.ObjectNode json)protected voidsetScorer(IScorer scorer)protected voidsetSerializer(ISerializer serializer)StringtoAlphaNumeric(String s)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.outofprintmagazine.nlp.pipeline.annotators.IOOPAnnotator
getDescription
-
-
-
-
Field Detail
-
scorer
protected IScorer scorer
-
serializer
protected ISerializer serializer
-
parameterStore
protected IParameterStore parameterStore
-
-
Method Detail
-
getSerializer
protected ISerializer getSerializer()
-
setSerializer
protected void setSerializer(ISerializer serializer)
-
getScorer
protected IScorer getScorer()
-
setScorer
protected void setScorer(IScorer scorer)
-
getAnnotationClass
public abstract Class getAnnotationClass()
- Specified by:
getAnnotationClassin interfaceIOOPAnnotator
-
init
public void init(IParameterStore parameterStore)
- Specified by:
initin interfaceIOOPAnnotator
-
getParameterStore
protected IParameterStore getParameterStore()
-
requirementsSatisfied
public Set<Class<? extends edu.stanford.nlp.ling.CoreAnnotation>> requirementsSatisfied()
- Specified by:
requirementsSatisfiedin interfaceedu.stanford.nlp.pipeline.Annotator
-
requires
public abstract Set<Class<? extends edu.stanford.nlp.ling.CoreAnnotation>> requires()
- Specified by:
requiresin interfaceedu.stanford.nlp.pipeline.Annotator
-
annotate
public abstract void annotate(edu.stanford.nlp.pipeline.Annotation annotation)
- Specified by:
annotatein interfaceedu.stanford.nlp.pipeline.Annotator
-
score
public void score(edu.stanford.nlp.pipeline.CoreDocument document)
- Specified by:
scorein interfaceIOOPAnnotator
-
serialize
public void serialize(edu.stanford.nlp.pipeline.CoreDocument document, com.fasterxml.jackson.databind.node.ObjectNode json)- Specified by:
serializein interfaceIOOPAnnotator
-
serializeAggregateDocument
public void serializeAggregateDocument(edu.stanford.nlp.pipeline.CoreDocument document, com.fasterxml.jackson.databind.node.ObjectNode json)- Specified by:
serializeAggregateDocumentin interfaceIOOPAnnotator
-
isPunctuationMark
public boolean isPunctuationMark(edu.stanford.nlp.ling.CoreLabel token)
-
hasPunctuationMark
public boolean hasPunctuationMark(edu.stanford.nlp.ling.CoreLabel token)
-
isDictionaryWord
public boolean isDictionaryWord(edu.stanford.nlp.ling.CoreLabel token)
-
addToScoreMap
public void addToScoreMap(Map<String,BigDecimal> scoreMap, String key, BigDecimal score)
-
addToScoreList
protected void addToScoreList(List<PhraseAnnotation> scoreMap, PhraseAnnotation p)
-
getContextWords
public List<edu.stanford.nlp.ling.CoreLabel> getContextWords(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token)
-
-