RelationArgumentUtil - apache/ctakes GitHub Wiki
Annotations that are used within text relations are buried 2 levels deep. This class has methods that make getting relation annotations easier, and others that make creating relations easier.
- Author: SPF , chip-nlp
- Version: %I%
-
Since: 5/25/2016
static public Collection<IdentifiedAnnotation> getFirstArguments( final Collection<? extends BinaryTextRelation> relations, final IdentifiedAnnotation annotation )
-
Parameters:
-
relationsrelations of interest -
annotationidentified annotation of interest
-
-
Returns: all identified annotations in the given relations related to the given annotation as the first argument
static public Collection<IdentifiedAnnotation> getSecondArguments( final Collection<? extends BinaryTextRelation> relations, final IdentifiedAnnotation annotation )
-
Parameters:
-
relationsrelations of interest -
annotationidentified annotation of interest
-
-
Returns: all identified annotations in the given relations related to the given annotation as the second argument
static public Collection<IdentifiedAnnotation> getAllRelated( final Collection<? extends BinaryTextRelation> relations, final IdentifiedAnnotation annotation )
-
Parameters:
-
relationsrelations of interest -
annotationidentified annotation of interest
-
-
Returns: all identified annotations in the given relations related to the given annotation
static public Map<BinaryTextRelation, IdentifiedAnnotation> getAllRelatedMap( final Collection<BinaryTextRelation> relations, final IdentifiedAnnotation annotation )
-
Parameters:
-
relationsrelations of interest -
annotationidentified annotation of interest
-
-
Returns: all identified annotations in the given relations related to the given annotation
static private IdentifiedAnnotation getRelated( final BinaryTextRelation relation, final IdentifiedAnnotation annotation )
-
Parameters:
-
relationrelation of interest -
annotationsome annotation that might be in the relation
-
-
Returns: the other annotation in the relation if the first is present
static private IdentifiedAnnotation getTarget( final BinaryTextRelation relation, final IdentifiedAnnotation annotation )
-
Parameters:
-
relationrelation of interest -
annotationsome annotation that might be in the relation
-
-
Returns: the target annotation in the relation if the first is present
static public Map<BinaryTextRelation, IdentifiedAnnotation> getRelatedTargetsMap( final Collection<BinaryTextRelation> relations, final IdentifiedAnnotation annotation )
-
Parameters:
-
relationsrelations of interest -
annotationidentified annotation of interest
-
-
Returns: all identified annotations in the given relations related to the given annotation
static public <T extends BinaryTextRelation> Collection<T> getRelationsAsFirst( final Collection<T> relations, final IdentifiedAnnotation annotation )
-
Parameters:
-
relationsrelations of interest -
annotationidentified annotation of interest
-
-
Returns: all relations in the given relations where the first argument is the given annotation
static public <T extends BinaryTextRelation> Collection<T> getRelationsAsSecond( final Collection<T> relations, final IdentifiedAnnotation annotation )
-
Parameters:
-
relationsrelations of interest -
annotationidentified annotation of interest
-
-
Returns: all relations in the given relations where the second argument is the given annotation
static public Map<IdentifiedAnnotation, Collection<IdentifiedAnnotation>> createCandidateMap( final JCas jcas, final List<IdentifiedAnnotation> candidates, final List<IdentifiedAnnotation> mainAnnotations )
Candidates for primary annotations of a possible relation are preceding candidates in the same paragraph, or if none then nearest following candidate in the same sentence
-
Parameters:
-
jcasye olde ... -
candidatesall candidates of a type in a paragraph -
mainAnnotationsall primary annotations of a type that has a relation in a paragraph
-
-
Returns: a map of candidates and the primary annotations for those candidates
static public BinaryTextRelation createRelation( final JCas jCas, final IdentifiedAnnotation argument, final IdentifiedAnnotation target, final String name )
-
Parameters:
-
jCasye olde ... -
argument- -
target- -
namename of relation type
-
-
Returns: created relation or null if there was a problem
static public <T extends BinaryTextRelation> T createRelation( final JCas jCas, T relation, final IdentifiedAnnotation argument, final IdentifiedAnnotation target, final String name )
-
Parameters:
-
jCasye olde ... -
relation- -
argument- -
target- -
namename of relation type
-
- Returns: created relation or null if there was a problem