Word Sourcer

This module contains an addon for basic Word Model, which makes it possible to work with word’s sources

class loglan_core.addons.word_sourcer.OriginParser(word)[source]

Bases: object

Test Class

class loglan_core.addons.word_sourcer.WordSource(source)[source]

Bases: object

Word Source from Word.origin for Prims

LANGUAGES = {'C': 'Chinese', 'E': 'English', 'F': 'French', 'G': 'German', 'H': 'Hindi', 'J': 'Japanese', 'R': 'Russian', 'S': 'Spanish'}
PATTERN_SOURCE = '\\d+\\/\\d+\\w'
__str__()[source]

Returns:

property as_string: str

Format WordSource as string, for example, ‘3/5R mesto’ :returns: str

static parse_source(compatibility_search)[source]
Parameters:

compatibility_search

Return type:

tuple[int, int, str]

Returns:

class loglan_core.addons.word_sourcer.WordSourcer[source]

Bases: object

WordSourcer Model

static _get_sources_c_prim(word)[source]

Returns:

Return type:

list[WordSource] | None

static _prepare_sources_cpd(word)[source]

Returns:

Return type:

list[str]

static _prepare_sources_cpx(word)[source]

Returns:

Return type:

list[str]

static get_parent_complex(origin)[source]

Args: .. admonition:: Example

zavdazflo -> zav(lo)+da(n)z(a)+fo/l(ma) => dazflo zanynurkokmio -> za(v)n(o)+y+nur+kok(fa)+mi(tr)o => nurkokmio cabsrusia -> cab(ro)+su/r(na)+si(tf)a => srusia beinracveo -> be(rt)i+n+(t)rac(i)+ve(sl)o => racveo

Returns:

Return type:

str

classmethod get_sources_cpd(word, as_str=False)[source]

Extract source words from self.origin field accordingly

Parameters:
  • word (BaseWord) – Word:

  • as_str (bool) – bool: return Word objects if False else as simple str

  • False) ((Default value =)

Return type:

Select | list[str]

Returns:

List of words from which the self.name was created

classmethod get_sources_cpx(word, as_str=False)[source]

Extract source words from self.origin field accordingly :type word: BaseWord :param word: :type word: Word :type as_str: bool :param as_str: return Word objects if False else as simple str :type as_str: bool :param (Default value = False):

Example

‘foldjacea’ > [‘forli’, ‘djano’, ‘cenja’]

Return type:

Select | list[str]

Returns:

List of words from which the self.name was created

classmethod get_sources_prim(word)[source]

Returns:

classmethod get_type_ids(types)[source]

Get ids of specific types from provided list

Parameters:

types (Iterable[str]) – List of types to get

Returns:

Subquery

static prepare_origin(origin)[source]

Remove text in parentheses, reverse characters between slash, remove slash.

Examples

zav(lo)+da(n)z(a)+fo/l(ma) => zav+daz+flo be(rt)i+n+(t)rac(i)+ve(sl)o => bei+n+rac+veo

Parameters:

origin (str) – str

Return type:

str

Returns: str

switch_prims = ['canli', 'farfu', 'folma', 'forli', 'kutla', 'marka', 'mordu', 'sanca', 'sordi', 'suksi', 'surna']
classmethod words_from_source_cpd(sources)[source]
Parameters:

sources (list[str])

Return type:

Select

Returns:

classmethod words_from_source_cpx(sources)[source]
Parameters:

sources (list[str])

Return type:

Select

Returns: