Module loglan_db.model_db.base_definition

This module contains a basic Definition Model

Classes

class BaseDefinition (**kwargs)

BaseDefinition model

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance's class are allowed. These could be, for example, any mapped columns or relationships.

Ancestors

  • sqlalchemy.orm.decl_api.Model
  • flask_sqlalchemy.model.Model
  • InitBase
  • DBBase

Subclasses

Class variables

var APPROVED_CASE_TAGS
var KEY_PATTERN

Static methods

def by_key(key: Union[BaseKey, str], language: str = None, case_sensitive: bool = False) ‑> flask_sqlalchemy.BaseQuery

Definition.Query filtered by specified key

Args

key
Union[BaseKey, str]:
language
str: Language of key (Default value = None)
case_sensitive
bool: (Default value = False)

Returns

BaseQuery

Instance variables

var body
var case_tags
var grammar : str

Combine definition's 'slots' and 'grammar_code' attributes

Returns

String with grammar data like (3v) or (2n)

var grammar_code
var id

Definition's internal ID number: Integer

var keys : flask_sqlalchemy.BaseQuery

Returns:

var language
var notes
var position
var slots
var source_word : flask_sqlalchemy.BaseQuery

Returns:

var usage
var word_id

Methods

Linking vernacular word with BaseDefinition object Only new word will be linked, skipping this that was previously linked

Args

word
str: name of BaseWord on vernacular language
language
str: BaseWord's language (Default value = None)

Returns

Linked BaseKey object or None if it were already linked

Universal method for linking all available types of key sources with BaseDefinition

Args

source
Union[List[str], str, None]: If no source is provided, keys will be extracted from the BaseDefinition's body If source is a string or a list of strings, the language of the keys must be specified TypeError will be raised if the source contains inappropriate data (Default value = None)
language
str: Language of BaseDefinition's keys (Default value = None)
pattern
str: Regex pattern for extracting keys from the BaseDefinition's body (Default value = KEY_PATTERN)

Returns

None, BaseKey, or List of BaseKeys

Extract and link keys from BaseDefinition's body

Args

language
str: Language of BaseDefinition's keys (Default value = None)
pattern
str: Regex pattern for extracting keys from the BaseDefinition's body (Default value = KEY_PATTERN)

Returns

List of linked BaseKey objects

Linking a list of vernacular words with BaseDefinition Only new words will be linked, skipping those that were previously linked

Args

source
List[str]: List of words on vernacular language
language
str: Language of source words (Default value = None)

Returns

List of linked BaseKey objects

Inherited members