EssentialAnnotationUtil - apache/ctakes GitHub Wiki
Utility to fetch integrated, coordinated collections of entities, events, and coreferences in a CAS.
- Author: SPF , chip-nlp
- Version: %I%
-
Since: 12/29/2017
static private Collection<IdentifiedAnnotation> getEssentialAnnotations( final Collection<IdentifiedAnnotation> annotations )
From a collection of annotations, get the events, times, and entities.
-
Parameters:
-
annotationsall IdentifiedAnnotations, regardless of type.
-
-
Returns: Collection of EventMentions, TimeMentions, and EntityMentions.
static private void cullToEssentialAnnotations( final Collection<Collection<IdentifiedAnnotation>> annotationCollections )
From multiple collections of annotations, remove everything that isn't an event, time, or entity.
-
Parameters:
-
annotationCollectionsall IdentifiedAnnotations, regardless of type.
-
static private Collection<IdentifiedAnnotation> getNonEssentialAnnotations( final Collection<IdentifiedAnnotation> allAnnotations, final Collection<IdentifiedAnnotation> unwantedAnnotations )
From a collection of annotations, get everything that is not in the collection of essential annotations.
-
Parameters:
-
allAnnotationsall IdentifiedAnnotations, regardless of type. -
unwantedAnnotationsunwanted annotations.
-
-
Returns: Collection of EventMentions, TimeMentions, and EntityMentions.
static public Collection<IdentifiedAnnotation> getRequiredAnnotations( final JCas jCas, final Map<IdentifiedAnnotation, Collection<Integer>> corefIndexed )
To allow fulfilled relations and coreference chains, we need essential annotations and related non-essential annotations.
-
Parameters:
-
jCasye olde ... -
corefIndexedmap of identified annotations to coreference chains containing them.
-
-
Returns: all events, times, and entities, plus annotations that are required for coreferences and relations.
static public Collection<IdentifiedAnnotation> getRequiredAnnotations( final JCas jCas, final Collection<IdentifiedAnnotation> allAnnotations, final Map<IdentifiedAnnotation, Collection<Integer>> corefIndexed )
To allow fulfilled relations and coreference chains, we need essential annotations and related non-essential annotations.
-
Parameters:
-
jCasye olds ... -
allAnnotationsall IdentifiedAnnotations, regardless of type. -
corefIndexedmap of identified annotations to coreference chains containing them.
-
-
Returns: all events, times, and entities, plus annotations that are required for coreferences and relations.
static public Collection<IdentifiedAnnotation> getRequiredAnnotations( final Collection<IdentifiedAnnotation> allAnnotations, final Map<IdentifiedAnnotation, Collection<Integer>> corefIndexed, final Collection<BinaryTextRelation> relations )
To allow fulfilled relations and coreference chains, we need essential annotations and related non-essential annotations.
-
Parameters:
-
allAnnotationsall IdentifiedAnnotations, regardless of type. -
corefIndexedmap of identified annotations to coreference chains containing them. -
relationsrelations between annotations.
-
-
Returns: all events, times, and entities, plus annotations that are required for coreferences and relations.
static public Map<IdentifiedAnnotation, Collection<Integer>> createMarkableCorefs( final JCas jCas )
-
Parameters:
-
jCasye olde ...
-
-
Returns: a map of coreferent annotations to indexed chain numbers.
static public Map<IdentifiedAnnotation, Collection<Integer>> createMarkableCorefs( final Collection<CollectionTextRelation> corefs, final Map<Markable, IdentifiedAnnotation> markableAnnotations )
-
Parameters:
-
corefscoreference chains. -
markableAnnotationsannotations that should be allowed in coreferences.
-
-
Returns: a map of coreferent annotations to indexed chain numbers.
static public Map<IdentifiedAnnotation, Collection<Integer>> createMarkableAssertedCorefs( final Collection<CollectionTextRelation> corefs, final Map<Markable, IdentifiedAnnotation> markableAnnotations )
Sometimes there will be two overlapping annotations, 1 affirmed 1 negated. Use this for matching assertions in coreference chains.
-
Parameters:
-
corefscoreference chains. -
markableAnnotationsannotations that should be allowed in coreferences.
-
-
Returns: a map of annotations to indexed chain numbers, separated by assertion status.
static public Map<IdentifiedAnnotation, Collection<Integer>> createAllMarkableAssertedCorefs( final JCas jCas )
Sometimes there will be two overlapping annotations, 1 affirmed 1 negated. Use this for matching assertions in coreference chains.
-
Parameters:
-
jCasye olde ...
-
-
Returns: a map of annotations to indexed chain numbers, separated by assertion status.
static public Map<IdentifiedAnnotation, Collection<Integer>> createAllMarkableAssertedCorefs( final Collection<CollectionTextRelation> corefs, final Map<Markable, Collection<IdentifiedAnnotation>> markableAnnotations )
Sometimes there will be two overlapping annotations, 1 affirmed 1 negated. Use this for matching assertions in coreference chains.
-
Parameters:
-
corefscoreference chains. -
markableAnnotationsannotations that should be allowed in coreferences.
-
-
Returns: a map of annotations to indexed chain numbers, separated by assertion status.
-
Parameters:
-
annotation-
-
-
Returns: string of concatenated assertion values: AFFIRMED, NEGATED, UNCERTAIN, GENERIC, CONDITIONAL.
static private Map<Markable, IdentifiedAnnotation> mapMarkableAnnotations( final JCas jCas, final Collection<CollectionTextRelation> corefs )
We can create a map of "best fit" single identified annotations for each coreference markable.
-
Parameters:
-
jCasye olde ... -
corefscollection of coref relations.
-
-
Returns: map of each coref markable to an identified annotation.
static public Map<Markable, Collection<IdentifiedAnnotation>> mapAllMarkableAnnotations( final JCas jCas, final Collection<CollectionTextRelation> corefs )
We can create a map of multiple overlapping identified annotations for each coreference markable.
-
Parameters:
-
jCasye olde ... -
corefscollection of coref relations.
-
-
Returns: map of each coref markable to an identified annotation.
Finds the head node out of a few ConllDependencyNodes. Biased toward nouns.
-
Parameters:
-
nodesdependency nodes.
-
-
Returns: best head node.
static public Collection<IdentifiedAnnotation> getRelationAnnotations( final Collection<BinaryTextRelation> relations )
-
Parameters:
-
relations-
-
-
Returns: all annotations in relations.
static private Collection<IdentifiedAnnotation> getEventMentions( final Collection<IdentifiedAnnotation> annotations )
-
Parameters:
-
annotationsall IdentifiedAnnotations, regardless of type.
-
-
Returns: collection of events in the annotations.
static private Map<IdentifiedAnnotation, Collection<IdentifiedAnnotation>> getAnnotationEvents( final Map<TextSpan, Collection<IdentifiedAnnotation>> annotationMap )
-
Parameters:
-
annotationMapmap of TextSpans for IdentifiedAnnotations with those text spans.
-
-
Returns: map of annotations to events.
There may be multiple sections with the same preferred name. We want unique names for each section.
-
Parameters:
-
section-
-
- Returns: Section Name + section ID or section ID or section Name or "Unknown Section".