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.WordSource(source)[source]
Bases:
objectWord 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'
- property as_string: str
Format WordSource as string, for example, ‘3/5R mesto’ :returns: str
- class loglan_core.addons.word_sourcer.WordSourcer[source]
Bases:
objectWordSourcer Model
- static _get_sources_c_prim(word)[source]
Returns:
- Return type:
list[WordSource] |None
- 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 strFalse) ((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_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']