Descriptor

class Descriptor(*args: Any)[source]

Bases: KIF_Object

Abstract base class for descriptors.

class AttributeMask(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Flags

Mask for descriptor attributes.

LABEL = 1

Mask for the label attribute of descriptor.

ALIASES = 2

Mask for the aliases attribute of descriptor.

DESCRIPTION = 4

Mask for the description attribute of descriptor.

DATATYPE = 8

Mask for the datatype attribute of descriptor.

LEMMA = 16

Mask for the lemma attribute of descriptor.

CATEGORY = 32

Mask for the lexical category attribute of descriptor.

LANGUAGE = 64

Mask for the language attribute of descriptor.

ITEM_DESCRIPTOR_ATTRIBUTES = 7

Mask for all attributes of item descriptor.

PROPERTY_DESCRIPTOR_ATTRIBUTES = 15

Mask for all attributes of property descriptor.

LEXEME_DESCRIPTOR_ATTRIBUTES = 112

Mask for all attributes of lexeme descriptor.

ALL = 127

Mask for all attributes of descriptor.

LABEL: Final[AttributeMask] = 1

Mask for the label attribute of descriptor.

ALIASES: Final[AttributeMask] = 2

Mask for the aliases attribute of descriptor.

DESCRIPTION: Final[AttributeMask] = 4

Mask for the description attribute of descriptor.

DATATYPE: Final[AttributeMask] = 8

Mask for the datatype attribute of descriptor.

LEMMA: Final[AttributeMask] = 16

Mask for the lemma attribute of descriptor.

CATEGORY: Final[AttributeMask] = 32

Mask for the lexical category attribute of descriptor.

LANGUAGE: Final[AttributeMask] = 64

Mask for the language attribute of descriptor.

ITEM_DESCRIPTOR_ATTRIBUTES: Final[AttributeMask] = 7

Mask for all attributes of item descriptor.

PROPERTY_DESCRIPTOR_ATTRIBUTES: Final[AttributeMask] = 15

Mask for all attributes of property descriptor.

LEXEME_DESCRIPTOR_ATTRIBUTES: Final[AttributeMask] = 112

Mask for all attributes of lexeme descriptor.

ALL: Final[AttributeMask] = 127

Mask for all attributes of descriptor.

class PlainDescriptor(*args: Any)[source]

Bases: Descriptor

Abstract base class for plain descriptors.

default_aliases: Final[TextSet] = TextSet()

Default aliases.

property label: Text | None

The label of plain descriptor.

get_label(default: Text | None = None) Text | None[source]

Gets the label of plain descriptor.

If the label is None, returns default.

Parameters:

default – Default label.

Returns:

Label.

property aliases: TextSet

The aliases of plain descriptor.

get_aliases() TextSet[source]

Gets the aliases of plain descriptor.

Returns:

Aliases.

property description: Text | None

The description of plain descriptor.

get_description(default: Text | None = None) Text | None[source]

Gets the description of plain descriptor.

If the description is None, returns default.

Parameters:

default – Default description.

Returns:

Description.

class ItemDescriptor(label: TText | None = None, aliases: TTextSet | None = None, description: TText | None = None)[source]

Bases: PlainDescriptor

Item descriptor.

Parameters:
  • label – Label.

  • aliases – Aliases.

  • description – Description.

__init__(label: TText | None = None, aliases: TTextSet | None = None, description: TText | None = None) None[source]
class PropertyDescriptor(label: TText | None = None, aliases: TTextSet | None = None, description: TText | None = None, datatype: TDatatype | None = None)[source]

Bases: PlainDescriptor

Property descriptor.

Parameters:
  • label – Label.

  • aliases – Aliases.

  • description – Description.

  • datatype – Datatype.

__init__(label: TText | None = None, aliases: TTextSet | None = None, description: TText | None = None, datatype: TDatatype | None = None) None[source]
property datatype: Datatype | None

The datatype of property descriptor.

get_datatype(default: Datatype | None = None) Datatype | None[source]

Gets the datatype of property descriptor.

If the datatype is None, returns default.

Parameters:

default – Default datatype.

Returns:

Datatype.

class LexemeDescriptor(lemma: TText | None = None, category: TItem | None = None, language: TItem | None = None)[source]

Bases: Descriptor

Lexeme descriptor.

Parameters:
  • lemma – Lemma.

  • category – Lexical category.

  • language – Language.

__init__(lemma: TText | None = None, category: TItem | None = None, language: TItem | None = None) None[source]
property lemma: Text | None

The lemma of lexeme descriptor.

get_lemma(default: Text | None = None) Text | None[source]

Gets the lemma of lexeme descriptor.

If the lemma is None, returns default.

Parameters:

default – Default lemma.

Returns:

Lemma.

property category: Item | None

The lexical category of lexeme descriptor.

get_category(default: Item | None = None) Item | None[source]

Gets the lexical category of lexeme descriptor.

If the lexical category is None, returns default.

Parameters:

default – Default lexical category.

Returns:

Lexical category.

property language: Item | None

The language of lexeme descriptor.

get_language(default: Item | None = None) Item | None[source]

Gets the language of lexeme descriptor.

If the language is None, returns default.

Parameters:

default – Default language.

Returns:

Language.