Class AbstractContextualAnnotator
- java.lang.Object
-
- io.outofprintmagazine.nlp.pipeline.annotators.AbstractAnnotator
-
- io.outofprintmagazine.nlp.pipeline.annotators.AbstractPosAnnotator
-
- io.outofprintmagazine.nlp.pipeline.annotators.AbstractContextualAnnotator
-
- All Implemented Interfaces:
edu.stanford.nlp.pipeline.Annotator
,IOOPAnnotator
- Direct Known Subclasses:
ActorsAnnotator
,SettingsAnnotator
public abstract class AbstractContextualAnnotator extends AbstractPosAnnotator implements edu.stanford.nlp.pipeline.Annotator, IOOPAnnotator
Base class for custom annotators that work with dependency trees (Core Nlp depparse).
- Author:
- Ram Sadasiv
-
-
Field Summary
-
Fields inherited from class io.outofprintmagazine.nlp.pipeline.annotators.AbstractPosAnnotator
tags
-
Fields inherited from class io.outofprintmagazine.nlp.pipeline.annotators.AbstractAnnotator
dictionaryPOS, parameterStore, punctuationMarks, scorer, 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 AbstractContextualAnnotator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
annotate(edu.stanford.nlp.pipeline.Annotation annotation)
protected abstract ContextualAnnotation
getConcreteAnnotation()
abstract Class
getEntityAnnotationClass()
Set<Class<? extends edu.stanford.nlp.ling.CoreAnnotation>>
requires()
void
score(edu.stanford.nlp.pipeline.CoreDocument document)
protected Map<String,BigDecimal>
scoreAdjectives(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
protected Map<String,BigDecimal>
scoreAdverbs(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
protected void
scoreDependencies(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token, ContextualAnnotation annotation)
protected void
scoreDependenciesDep(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token, ContextualAnnotation annotation)
protected void
scoreDependenciesGov(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token, ContextualAnnotation annotation)
protected void
scoreDocument(edu.stanford.nlp.pipeline.CoreDocument document, ContextualAnnotation annotation)
protected Map<String,BigDecimal>
scoreNounGroups(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
protected Map<String,BigDecimal>
scoreNouns(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
protected void
scoreSentence(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.pipeline.CoreSentence sentence, ContextualAnnotation annotation)
protected void
scoreSubAnnotation(Map<String,BigDecimal> annotationScore, Map<String,BigDecimal> existingScoreMap)
protected void
scoreThumbnails(ContextualAnnotation annotation)
protected void
scoreToken(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token, ContextualAnnotation annotation)
protected Map<String,BigDecimal>
scoreVerbGroups(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
protected Map<String,BigDecimal>
scoreVerbs(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
protected void
scoreWikipediaGloss(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token, ContextualAnnotation annotation)
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)
-
Methods inherited from class io.outofprintmagazine.nlp.pipeline.annotators.AbstractPosAnnotator
appendTagsFromFile, getTags, scoreLemma, scoreLemma, scoreTag, scoreTag, scoreToken, scoreToken, setTags
-
Methods inherited from class io.outofprintmagazine.nlp.pipeline.annotators.AbstractAnnotator
addToScoreList, addToScoreMap, getAnnotationClass, getContextWords, getParameterStore, getScorer, getSerializer, hasPunctuationMark, init, isDictionaryWord, isPunctuationMark, requirementsSatisfied, setScorer, setSerializer, toAlphaNumeric
-
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
getAnnotationClass, getDescription, init
-
-
-
-
Method Detail
-
getEntityAnnotationClass
public abstract Class getEntityAnnotationClass()
-
getConcreteAnnotation
protected abstract ContextualAnnotation getConcreteAnnotation()
-
requires
public Set<Class<? extends edu.stanford.nlp.ling.CoreAnnotation>> requires()
- Specified by:
requires
in interfaceedu.stanford.nlp.pipeline.Annotator
- Overrides:
requires
in classAbstractPosAnnotator
-
annotate
public void annotate(edu.stanford.nlp.pipeline.Annotation annotation)
- Specified by:
annotate
in interfaceedu.stanford.nlp.pipeline.Annotator
- Specified by:
annotate
in classAbstractAnnotator
-
score
public void score(edu.stanford.nlp.pipeline.CoreDocument document)
- Specified by:
score
in interfaceIOOPAnnotator
- Overrides:
score
in classAbstractAnnotator
-
serialize
public void serialize(edu.stanford.nlp.pipeline.CoreDocument document, com.fasterxml.jackson.databind.node.ObjectNode json)
- Specified by:
serialize
in interfaceIOOPAnnotator
- Overrides:
serialize
in classAbstractAnnotator
-
serializeAggregateDocument
public void serializeAggregateDocument(edu.stanford.nlp.pipeline.CoreDocument document, com.fasterxml.jackson.databind.node.ObjectNode json)
- Specified by:
serializeAggregateDocument
in interfaceIOOPAnnotator
- Overrides:
serializeAggregateDocument
in classAbstractAnnotator
-
scoreDocument
protected void scoreDocument(edu.stanford.nlp.pipeline.CoreDocument document, ContextualAnnotation annotation) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException, URISyntaxException, com.flickr4java.flickr.FlickrException
- Throws:
InstantiationException
IllegalAccessException
ClassNotFoundException
IOException
URISyntaxException
com.flickr4java.flickr.FlickrException
-
scoreThumbnails
protected void scoreThumbnails(ContextualAnnotation annotation) throws IOException, URISyntaxException, com.flickr4java.flickr.FlickrException
- Throws:
IOException
URISyntaxException
com.flickr4java.flickr.FlickrException
-
scoreSentence
protected void scoreSentence(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.pipeline.CoreSentence sentence, ContextualAnnotation annotation) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException
-
scoreToken
protected void scoreToken(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token, ContextualAnnotation annotation) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException
-
scoreWikipediaGloss
protected void scoreWikipediaGloss(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token, ContextualAnnotation annotation)
-
scoreSubAnnotation
protected void scoreSubAnnotation(Map<String,BigDecimal> annotationScore, Map<String,BigDecimal> existingScoreMap)
-
scoreVerbs
protected Map<String,BigDecimal> scoreVerbs(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
-
scoreVerbGroups
protected Map<String,BigDecimal> scoreVerbGroups(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
-
scoreAdverbs
protected Map<String,BigDecimal> scoreAdverbs(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
-
scoreAdjectives
protected Map<String,BigDecimal> scoreAdjectives(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
-
scoreNouns
protected Map<String,BigDecimal> scoreNouns(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
-
scoreNounGroups
protected Map<String,BigDecimal> scoreNounGroups(edu.stanford.nlp.ling.CoreLabel token, Map<String,BigDecimal> existingScoreMap)
-
scoreDependencies
protected void scoreDependencies(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token, ContextualAnnotation annotation) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException
-
scoreDependenciesGov
protected void scoreDependenciesGov(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token, ContextualAnnotation annotation) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException
-
scoreDependenciesDep
protected void scoreDependenciesDep(edu.stanford.nlp.pipeline.CoreDocument document, edu.stanford.nlp.ling.CoreLabel token, ContextualAnnotation annotation) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException
-
-