colonel.base_rich_sentence_element module¶
Module providing the BaseRichSentenceElement
class.
-
class
colonel.base_rich_sentence_element.
BaseRichSentenceElement
(lemma=None, upos=None, xpos=None, feats=None, deps=None, **kwargs)[source]¶ Bases:
colonel.base_sentence_element.BaseSentenceElement
Abstract class containing basic information in common with some specific elements being part of a sentence.
It is compliant with the CoNLL-U format, in the sense that it provides a common foundation for elements of type word and empty nodes, which can be made up of a richer set of fields in comparison to other elements, such as the (multiword) tokens.
-
deps
¶ Enhanced dependency graph, usually in the form of a list of head-deprel pairs.
It is compatible with CoNLL-U
DEPS
field.You are free to assign to it any kind of value suitable for your project.
-
feats
¶ List of morphological features from the universal feature inventory or from a defined language-specific extension.
It is compatible with CoNLL-U
FEATS
field.You are free to assign to it any kind of value suitable for your project.
-
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.
An instance of type
BaseRichSentenceElement
is always considered valid, independently from any value of its attributes (it doesn’t provide any additional check to the overridden superclass method).
-
lemma
¶ Lemma of the element.
It is compatible with CoNLL-U
LEMMA
field.
-
to_conllu
()[source]¶ Returns a CoNLL-U formatted representation of the element.
This method is expected to be overridden by each specific element.
-
upos
¶ Universal part-of-speech tag.
It is compatible with CoNLL-U
UPOS
field.
-
xpos
¶ Language-specific part-of-speech tag.
It is compatible with CoNLL-U
XPOS
field.
-