Definition

This module contains a basic Definition Model

class loglan_core.definition.BaseDefinition(word_id, position, body, usage=None, grammar_code=None, slots=None, case_tags=None, language=None, notes=None)[source]

Bases: BaseModel

The BaseDefinition model.

word_id

The ID of the word.

Type:

Mapped[int]

position

The position of the word.

Type:

Mapped[int]

body

The body of the word.

Type:

Mapped[str]

usage

The usage of the word.

Type:

Mapped[str_064] | None

grammar_code

The grammar code of the word.

Type:

Mapped[str_008] | None

slots

The slots of the word.

Type:

Mapped[int] | None

case_tags

The case tags of the word.

Type:

Mapped[str_016] | None

language

The language of the word.

Type:

Mapped[str_016] | None

notes

The notes of the word.

Type:

Mapped[str_255] | None

APPROVED_CASE_TAGS

A tuple of approved case tags.

Type:

tuple

KEY_PATTERN

The pattern for the key.

Type:

str

keys

The relationship of keys.

Type:

Mapped[list[BaseKey]]

source_word

The relationship of source word.

Type:

Mapped[“BaseWord”]

APPROVED_CASE_TAGS = ('B', 'C', 'D', 'F', 'G', 'J', 'K', 'N', 'P', 'S', 'V')
KEY_PATTERN = '(?<=\\«)(.+?)(?=\\»)'
__str__()[source]

String representation of the BaseDefinition object.

Returns:

A string representation of the object.

Return type:

str

body: Mapped[str]
case_tags: Mapped[str_016 | None]
created: Mapped[datetime]

A class attribute mapped to a column in the database table. It represents the timestamp when a row is created. The default value is the current timestamp, and it can’t be null.

Type:

datetime

property grammar: str

Combine definition’s ‘slots’ and ‘grammar_code’ attributes.

Returns:

String with grammar data like (3v) or (2n), or an empty string if both are None.

grammar_code: Mapped[str_008 | None]
id: Mapped[int]

A class attribute mapped to a column in the database table. It serves as the primary key for the table.

Type:

int

keys: Mapped[list[BaseKey]]
language: Mapped[str_016 | None]
notes: Mapped[str_255 | None]
position: Mapped[int]
slots: Mapped[int | None]
source_word: Mapped[BaseWord]
updated: Mapped[datetime | None]

A class attribute mapped to a column in the database table. It represents the timestamp when a row is last updated. Whenever the row is updated, this timestamp is automatically set to the current time. It can be null if the row has never been updated.

Type:

datetime

usage: Mapped[str_064 | None]
word_id: Mapped[int]