colonel.emptynode module

Module providing the EmptyNode class.

class colonel.emptynode.EmptyNode(main_index=None, sub_index=None, **kwargs)[source]

Bases: colonel.base_rich_sentence_element.BaseRichSentenceElement

Representation of an Empty Node sentence element

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 EmptyNode is considered valid only when main_index is set to a value equal to or greater than zero (0) and sub_index is set to a value greater than zero (0).

Return type:bool
main_index

The primary index of the empty node.

This usually corresponds to the value of the Word.index after which the empty node is inserted, or to zero (0) if the empty node is inserted before the first word of the sentence (the one with index equal to 1).

It is compatible with CoNLL-U ID field, which in case of an empty node is a decimal number: the main index here corresponds to the integer part of such value.

sub_index

The secondary index of the empty node.

It is compatible with CoNLL-U ID field, which in case of an empty node is a decimal number: the sub index here corresponds to the decimal part of such value.

to_conllu()[source]

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