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>
dictionaryPOS
protected IParameterStore
parameterStore
protected List<String>
punctuationMarks
protected IScorer
scorer
protected ISerializer
serializer
-
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 void
addToScoreList(List<PhraseAnnotation> scoreMap, PhraseAnnotation p)
void
addToScoreMap(Map<String,BigDecimal> scoreMap, String key, BigDecimal score)
abstract void
annotate(edu.stanford.nlp.pipeline.Annotation annotation)
abstract Class
getAnnotationClass()
List<edu.stanford.nlp.ling.CoreLabel>
getContextWords(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token)
protected IParameterStore
getParameterStore()
protected IScorer
getScorer()
protected ISerializer
getSerializer()
boolean
hasPunctuationMark(edu.stanford.nlp.ling.CoreLabel token)
void
init(IParameterStore parameterStore)
boolean
isDictionaryWord(edu.stanford.nlp.ling.CoreLabel token)
boolean
isPunctuationMark(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()
void
score(edu.stanford.nlp.pipeline.CoreDocument document)
void
serialize(edu.stanford.nlp.pipeline.CoreDocument document, com.fasterxml.jackson.databind.node.ObjectNode json)
void
serializeAggregateDocument(edu.stanford.nlp.pipeline.CoreDocument document, com.fasterxml.jackson.databind.node.ObjectNode json)
protected void
setScorer(IScorer scorer)
protected void
setSerializer(ISerializer serializer)
String
toAlphaNumeric(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:
getAnnotationClass
in interfaceIOOPAnnotator
-
init
public void init(IParameterStore parameterStore)
- Specified by:
init
in interfaceIOOPAnnotator
-
getParameterStore
protected IParameterStore getParameterStore()
-
requirementsSatisfied
public Set<Class<? extends edu.stanford.nlp.ling.CoreAnnotation>> requirementsSatisfied()
- Specified by:
requirementsSatisfied
in interfaceedu.stanford.nlp.pipeline.Annotator
-
requires
public abstract Set<Class<? extends edu.stanford.nlp.ling.CoreAnnotation>> requires()
- Specified by:
requires
in interfaceedu.stanford.nlp.pipeline.Annotator
-
annotate
public abstract void annotate(edu.stanford.nlp.pipeline.Annotation annotation)
- Specified by:
annotate
in interfaceedu.stanford.nlp.pipeline.Annotator
-
score
public void score(edu.stanford.nlp.pipeline.CoreDocument document)
- Specified by:
score
in interfaceIOOPAnnotator
-
serialize
public void serialize(edu.stanford.nlp.pipeline.CoreDocument document, com.fasterxml.jackson.databind.node.ObjectNode json)
- Specified by:
serialize
in interfaceIOOPAnnotator
-
serializeAggregateDocument
public void serializeAggregateDocument(edu.stanford.nlp.pipeline.CoreDocument document, com.fasterxml.jackson.databind.node.ObjectNode json)
- Specified by:
serializeAggregateDocument
in 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)
-
-