Terminal¶
-
class
ucca.layer0.
Terminal
(ID, root, tag, attrib=None, *, orderkey=<function edge_id_orderkey>)[source]¶ Bases:
ucca.core.Node
Layer 0 Node type, represents a word or a punctuation mark.
Terminals are
core
.Node objects which represent a word or a punctuation mark in thecore
.Passage object. They are immutable, as they shouldn’t be changed throughout their use and have no children. Hence, they can be compared and hashed, unlike other core.Node subclasses.- Attributes:
ID: the unique ID of each Terminal is its global position in the Passage, e.g. ID=0.4 is the 4th Terminal in the
Passage
. tag: from NodeTags layer: ‘0’ (LAYER_ID) attrib: returns a copy of the attribute dictionary, so changing itwill not affect the Terminal objecttext: text of the Terminal, whether punctuation or a word position: global position of the Terminal in the passage, starting at 1 paragraph: which paragraph the Terminal belongs to, starting at 1 para_pos: the position of the Terminal in the paragraph,
starting at 1 (per paragraph).punct: whether the Terminal is a punctuation mark (boolean)
Attributes Summary
attrib
para_pos
paragraph
position
punct
text
tok
Methods Summary
add
(*args, **kwargs)partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords. equals
(other, *[, ordered])Equals if the Terminals are of the same Layer, tag, position & text. get_annotation
(attr[, as_array])get_terminals
([punct])Returns a list containing just this Terminal. remove
(*args, **kwargs)partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords. Attributes Documentation
-
attrib
¶
-
para_pos
¶
-
paragraph
¶
-
position
¶
-
punct
¶
-
text
¶
-
tok
¶
Methods Documentation
-
add
(*args, **kwargs)[source]¶ partial(func, *args, **keywords) - new function with partial application of the given arguments and keywords.
-
equals
(other, *, ordered=False, **kwargs)[source]¶ Equals if the Terminals are of the same Layer, tag, position & text.
Parameters: - other – another Terminal to equal to
- ordered – unused, here for API conformity.
Returns: True iff the two Terminals are equal.