colonel.word module¶
Module providing the Word
class.
-
class
colonel.word.
Word
(index=None, head=None, deprel=None, **kwargs)[source]¶ Bases:
colonel.base_rich_sentence_element.BaseRichSentenceElement
Representation of a Word sentence element
-
deprel
¶ Universal dependency relation to the
head
or a defined language-specific subtype of one.It is compatible with CoNLL-U
DEPREL
field.
-
head
¶ Head of the current word, which is usually a value of another Word’s
index
or zero (0
, forroot
grammatical relations).It is compatible with CoNLL-U
HEAD
field.
-
index
¶ Word index.
It is compatible with CoNLL-U
ID
field.The term index has been preferred over the more conventional ID, mostly for the purpose of preventing confusion, especially with Python’s
id()
built-in function (which returns the “identity” of an object).
-
is_valid
()[source]¶ Returns whether or not the object can be considered valid, however ignoring the context of the sentence in which the word itself is possibly inserted.
In compliance with the CoNLL-U format, an instance of type
Word
is considered valid only whenindex
is set to a value greater than zero (0
).Return type: bool
-