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


Universal dependency relation to the head or a defined language-specific subtype of one.

It is compatible with CoNLL-U DEPREL field.


Head of the current word, which is usually a value of another Word’s index or zero (0, for root grammatical relations).

It is compatible with CoNLL-U HEAD field.


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).


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 when index is set to a value greater than zero (0).

Return type:bool

Returns a CoNLL-U formatted representation of the element.

No validity check is performed on the attributes; values not compatible with CoNLL-U format could lead to an incorrect output value or raising of exceptions.

Return type:str