AnnotationNode

class polyglotdb.query.annotations.attributes.base.AnnotationNode(node_type, corpus=None, hierarchy=None)[source]

Class for annotations referenced in graph queries

Parameters:
type : str

Annotation type

pos : int

Position in the query, defaults to 0

Attributes:
type : str

Annotation type

pos : int

Position in the query

previous : AnnotationAttribute

Returns the Annotation of the same type with the previous position

following : AnnotationAttribute

Returns the Annotation of the same type with the following position

Methods

__init__(node_type[, corpus, hierarchy]) Initialize self.
filter_by_subset(*args) adds each item in args to the hierarchy type_labels
follows(other_annotation)
for_json()
for_match() sets ‘token_alias’ and ‘type_alias’ keyword arguments for an annotation
precedes(other_annotation)
alias

Returns a cypher formatted string of keys and prefixes

define_alias

Returns a cypher string for getting all token_labels

define_type_alias

Returns a cypher string for getting all type_labels

filter_by_subset(*args)[source]

adds each item in args to the hierarchy type_labels

for_match()[source]

sets ‘token_alias’ and ‘type_alias’ keyword arguments for an annotation

labels_alias

Returns alias

type_alias

Returns a cypher formatted string of type alias

with_alias

Returns alias

withs

Returns a list of alias and type_alias