In [2]:
# add ieml library to kernel path
import sys
sys.path.insert(0, '..')

The ieml library exposes a parser (ieml.usl.parser) that parses ieml strings (including older versions) and return a normalised ieml.usl.USL object or a ieml.dictionary.Script (a morpheme). For the moment only ieml.usl.Word are valid ieml.usl.USL.

The ieml.usl.USL can be checked for coherancy with ieml.usl.USL.check(). That feature should be added in a strict mode for the parser.


In [3]:
from ieml.usl.usl import usl
u = usl("[E:.b.E:B:.- E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(a.T:.-) > ! E:.l.- (E:.wo.- E:S:.-d.u.-')]")
u.check()
print(u)
u1 = usl("[E:.b.E:B:.- E:S:. (E:.-'wu.-S:.-'t.o.-', E:.-wa.-t.o.-' )(a.T:.-) > ! E:.l.- (E:.wo.- E:S:.-d.u.-')]")
u1.check()
print(u1)
assert u1 == u


[E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(a.T:.-) > ! E:.l.- (E:.wo.- E:S:.-d.u.-')]
[E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(a.T:.-) > ! E:.l.- (E:.wo.- E:S:.-d.u.-')]

The ieml lexicons are stored on github, they have to be downloaded first


In [4]:
from ieml.ieml_database import GitInterface, IEMLDatabase
gitdb = GitInterface()
gitdb.pull() # download database in ~/.cache/ieml/ folder
print(gitdb)

# instanciate a ieml.ieml_database.IEMLDatabase from the downloaded git repository
db = IEMLDatabase(folder=gitdb.folder)
print(db)


<ieml.ieml_database.git_interface.GitInterface object at 0x7fd458e0eba8>
<ieml.ieml_database.ieml_database (/home/louis/.cache/ieml/1.0.3/e3050257e00f171aa548e17e73fe562e cache=/home/louis/.cache/ieml/1.0.3/e3050257e00f171aa548e17e73fe562e)>

In [8]:
morphs = db.list(type='morpheme')[:100]

The ieml.ieml_database.IEMLDatabase is responsible of reading and writing association between ieml.usl.USL and ieml.dictionary.Script with their translation to disk. The values as stored in rows in one file per USL. The format of the rows are space separated values (ssv like csv or tsv).


In [12]:
desc = db.get_descriptors()
desc.get_values_partial(morphs[0])


Out[12]:
{("b.i.-n.i.-'t.i.-'+m.i.-f.i.-'+l.i.-E:.-+n.+f.i.-'n.-B:.A:.-',",
  'en',
  'translations'): ['metallic vibrator'],
 ("b.i.-n.i.-'t.i.-'+m.i.-f.i.-'+l.i.-E:.-+n.+f.i.-'n.-B:.A:.-',",
  'fr',
  'translations'): ['vibrateur de métal']}

In [5]:
w = db.list(type='word', parse=True)[1]

In [6]:
list(w.iter_structure())


Out[6]:
[<ieml.usl.lexeme.Lexeme at 0x7fd42ccb6390>]

ieml.dictionary.Script

The Script is a old name for morphemes. The

Words


In [4]:
# ou se trouve le pointd'exclamation
str(u.role)


Out[4]:
'E:.l.-'

In [5]:
print('\n'.join(str(r) + ' ' + str(a.actor) for r, a in u.syntagmatic_fun.actors.items()))


E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(a.T:.-)
E:.l.- (E:.wo.- E:S:.-d.u.-')

In [6]:
from ieml.usl.constants import ADDRESS_SCRIPTS,NAMES_TO_ADDRESS 

# list des roles syntagmatic
print('\n'.join(str(r) + ' ' + NAMES_TO_ADDRESS[r] for r in ADDRESS_SCRIPTS))


E:S:. process
E:T:. process
E:B:. process
E:.n.- initiator
E:.d.- interactant
E:.k.- recipient
E:.t.- time
E:.l.- location
E:.m.- intention
E:.f.- manner
E:.s.- cause
E:A:. dependant
E:U:. independant

In [7]:
from requests import get

from ieml.usl.word import Word
from ieml.usl.usl import usl

def get_word_structure(w: Word):
    return get("https://dev.intlekt.io/api/words/{}/?repository=IEMLdev".format(str(w))).json()

"""
The structure for any Ieml is :
IemlEntry = { 
    'ieml': string,
    
    'cardinality': 'singular_sequence' | 'paradigm' | 'root_paradigm',
    'class': 'Noun'|'Verb'|'Auxialiary',
    'type': 'word' | 'morpheme' | 'polymorpheme' | 'lexeme',
    
    'comments': {'en': [], 'fr': []},
    'tags': {'en': [], 'fr': []},
    'translations': {'en': [], 'fr': []},
    
    'created': True|False, # if exists in db, equivalent of 'comments', 'tags' or'translations'  at a least one value
    'editable': True|False, # if exists in db and not in the main db or doesn't exists in db
    'domains': [],
    
    'index': string, # string value to order the usls from each other
    'main_table': None, # main table for morpheme
    'paradigm': True|False, # is a paradigm ?
    
    'singular_sequences': None|IemlEntry[], # if not a paradigm, None, otherwise the list of the singular sequences (the cells of the table)
}

For Words, we had the following entries :
WordsEntry = IemlEntry + {
    'role': string[], # the tree address where to put the '!'
    'syntagmatic_function': SyntagmaticFunctionEntry # the tree
}

LexemeEntry = IemlEntry + {
    'pm_content': PolyMorphemeEntry,
    'pm_flexion': PolyMorphemeEntry
}

PolyMorphemeEntry = IemlEntry + {
    'constant': MorphemeEntry[], # the constant of the polymorphemes
    'groups': (MorphemeEntry, 0|1|2)[], # the variables with theirs multiplicities.
}

MorphemeEntry = IemlEntry


The tree structure : a tree of subtype of SyntagmaticFunctionEntry. The nodes are accessed with the actor property.


SyntagmaticFunctionEntry = {
    'actor': LexemeEntry, # the lexeme at this node in the tree
    
    'role_full': string[], # the address of thisnode in the tree
    'role': string, # the last value of the address (role_full[-1])
    
    'type': 'ProcessSyntagmaticFunction'| 'DependantQualitySyntagmaticFunction'|'IndependantQualitySyntagmaticFunction', 
    # There is 3 types of syntagmatic functions, process for verbal frames, dependant for actants (nouns) and independant for adjectives.
}
 
ProcessSyntagmaticFunctionEntry = SyntagmaticFunctionEntry + {
    'valence': 1|2|3,
    'initiator': DependantQualitySyntagmaticFunctionEntry,
    'recipient': DependantQualitySyntagmaticFunctionEntry, # always None is valence < 2
    'interactant': DependantQualitySyntagmaticFunctionEntry, # always None is valence < 3
    
    'cause': DependantQualitySyntagmaticFunctionEntry,
    'intention': DependantQualitySyntagmaticFunctionEntry,
    'manner': DependantQualitySyntagmaticFunctionEntry,
    'time': DependantQualitySyntagmaticFunctionEntry,
    'location': DependantQualitySyntagmaticFunctionEntry,
}

DependantQualitySyntagmaticFunctionEntry = SyntagmaticFunctionEntry + {
    'independant': IndependantQualitySyntagmaticFunction,
    'dependant': DependantQualitySyntagmaticFunctionEntry
}

IndependantQualitySyntagmaticFunction = SyntagmaticFunctionEntry


"""



get_word_structure(usl("[! E:A:. (wa.)]"))


Out[7]:
{'cardinality': 'singular_sequence',
 'class': 'Noun',
 'comments': {'en': [], 'fr': []},
 'created': False,
 'domains': [],
 'editable': True,
 'ieml': '[! E:A:.  (wa.)]',
 'index': '3000000000000000000000000000000',
 'main_table': None,
 'paradigm': False,
 'role': ['dependant'],
 'singular_sequences': None,
 'syntagmatic_function': {'actor': {'cardinality': 'singular_sequence',
   'class': 'Auxiliary',
   'comments': {'en': [], 'fr': []},
   'created': False,
   'domains': [],
   'editable': True,
   'ieml': '(wa.)',
   'index': '2000000000000000000000000000000',
   'main_table': None,
   'paradigm': False,
   'pm_content': {'cardinality': 'singular_sequence',
    'class': 'Auxiliary',
    'comments': {'en': ['In IEML, all auxiliaries begin by the letter *E*.'],
     'fr': ['En IEML, tous les auxiliaires commencent par la lettre *E*.']},
    'constant': [{'cardinality': 'singular_sequence',
      'class': 'Auxiliary',
      'comments': {'en': ['In IEML, all auxiliaries begin by the letter *E*.'],
       'fr': ['En IEML, tous les auxiliaires commencent par la lettre *E*.']},
      'created': True,
      'domains': [],
      'editable': False,
      'ieml': 'E:',
      'index': '0000000000000000000000000000000',
      'main_table': 'I:',
      'paradigm': False,
      'singular_sequences': None,
      'tags': {'en': [], 'fr': []},
      'translations': {'en': ['emptiness', 'monad', 'syntactic place'],
       'fr': ['vide', 'monade', 'place syntaxique']},
      'type': 'morpheme'}],
    'created': True,
    'domains': [],
    'editable': False,
    'groups': [],
    'ieml': 'E:',
    'index': '0000000000000000000000000000000',
    'main_table': 'I:',
    'paradigm': False,
    'singular_sequences': None,
    'size': 1,
    'tags': {'en': [], 'fr': []},
    'translations': {'en': ['emptiness', 'monad', 'syntactic place'],
     'fr': ['vide', 'monade', 'place syntaxique']},
    'type': 'morpheme'},
   'pm_flexion': {'cardinality': 'singular_sequence',
    'class': 'Verb',
    'comments': {'en': [], 'fr': []},
    'constant': [{'cardinality': 'singular_sequence',
      'class': 'Verb',
      'comments': {'en': [], 'fr': []},
      'created': True,
      'domains': [],
      'editable': False,
      'ieml': 'wa.',
      'index': '000000000000000000000000000000f',
      'main_table': 'O:O:.',
      'paradigm': False,
      'singular_sequences': None,
      'tags': {'en': [], 'fr': []},
      'translations': {'en': ['act', 'perform'], 'fr': ['agir', 'exercer']},
      'type': 'morpheme'}],
    'created': True,
    'domains': [],
    'editable': False,
    'groups': [],
    'ieml': 'wa.',
    'index': '000000000000000000000000000000f',
    'main_table': 'O:O:.',
    'paradigm': False,
    'singular_sequences': None,
    'size': 1,
    'tags': {'en': [], 'fr': []},
    'translations': {'en': ['act', 'perform'], 'fr': ['agir', 'exercer']},
    'type': 'morpheme'},
   'singular_sequences': None,
   'tags': {'en': [], 'fr': []},
   'translations': {'en': [], 'fr': []},
   'type': 'lexeme'},
  'dependant': None,
  'independant': None,
  'lexemes': [{'cardinality': 'singular_sequence',
    'class': 'Auxiliary',
    'comments': {'en': [], 'fr': []},
    'created': False,
    'domains': [],
    'editable': True,
    'ieml': '(wa.)',
    'index': '2000000000000000000000000000000',
    'main_table': None,
    'paradigm': False,
    'pm_content': {'cardinality': 'singular_sequence',
     'class': 'Auxiliary',
     'comments': {'en': ['In IEML, all auxiliaries begin by the letter *E*.'],
      'fr': ['En IEML, tous les auxiliaires commencent par la lettre *E*.']},
     'constant': [{'cardinality': 'singular_sequence',
       'class': 'Auxiliary',
       'comments': {'en': ['In IEML, all auxiliaries begin by the letter *E*.'],
        'fr': ['En IEML, tous les auxiliaires commencent par la lettre *E*.']},
       'created': True,
       'domains': [],
       'editable': False,
       'ieml': 'E:',
       'index': '0000000000000000000000000000000',
       'main_table': 'I:',
       'paradigm': False,
       'singular_sequences': None,
       'tags': {'en': [], 'fr': []},
       'translations': {'en': ['emptiness', 'monad', 'syntactic place'],
        'fr': ['vide', 'monade', 'place syntaxique']},
       'type': 'morpheme'}],
     'created': True,
     'domains': [],
     'editable': False,
     'groups': [],
     'ieml': 'E:',
     'index': '0000000000000000000000000000000',
     'main_table': 'I:',
     'paradigm': False,
     'singular_sequences': None,
     'size': 1,
     'tags': {'en': [], 'fr': []},
     'translations': {'en': ['emptiness', 'monad', 'syntactic place'],
      'fr': ['vide', 'monade', 'place syntaxique']},
     'type': 'morpheme'},
    'pm_flexion': {'cardinality': 'singular_sequence',
     'class': 'Verb',
     'comments': {'en': [], 'fr': []},
     'constant': [{'cardinality': 'singular_sequence',
       'class': 'Verb',
       'comments': {'en': [], 'fr': []},
       'created': True,
       'domains': [],
       'editable': False,
       'ieml': 'wa.',
       'index': '000000000000000000000000000000f',
       'main_table': 'O:O:.',
       'paradigm': False,
       'singular_sequences': None,
       'tags': {'en': [], 'fr': []},
       'translations': {'en': ['act', 'perform'], 'fr': ['agir', 'exercer']},
       'type': 'morpheme'}],
     'created': True,
     'domains': [],
     'editable': False,
     'groups': [],
     'ieml': 'wa.',
     'index': '000000000000000000000000000000f',
     'main_table': 'O:O:.',
     'paradigm': False,
     'singular_sequences': None,
     'size': 1,
     'tags': {'en': [], 'fr': []},
     'translations': {'en': ['act', 'perform'], 'fr': ['agir', 'exercer']},
     'type': 'morpheme'},
    'singular_sequences': None,
    'tags': {'en': [], 'fr': []},
    'translations': {'en': [], 'fr': []},
    'type': 'lexeme'}],
  'role': 'dependant',
  'role_full': ['dependant'],
  'type': 'DependantQualitySyntagmaticFunction'},
 'tags': {'en': [], 'fr': []},
 'translations': {'en': [], 'fr': []},
 'type': 'word'}

In [19]:
from itertools import chain

def list_polymorpheme_of_word(w):
    w = usl(w)
    assert isinstance(w, Word)
    
    
    # w.syntagmatic_fun correspond à l'arbre syntagmatic du mot w
    # w.syntagmatic_fun.actors correspond à un dictionnaire qui associe tous les roles vers toutes les fonction syntagmatics presentent en descendance du noeud courant
    # donc sfun correspond successivement à chacun des noeuds de l'arbre
    # sfun.actor correspond au lexeme du noeud sfun
    # sfun.actor.pm_flexion correspond au polymorpheme de flexion et 
    # sfun.actor.pm_content correspond au polymorpheme de contenu
    return list(chain.from_iterable((sfun.actor.pm_content, sfun.actor.pm_flexion) 
                                    for sfun in w.syntagmatic_fun.actors.values()))
    
pl = list_polymorpheme_of_word("[! E:A:.  (E:.wo.- E:S:.-d.u.-')(b.-S:.A:.-'S:.-'S:.-',) > E:A:. E:A:. (E:.wo.- E:S:.-d.u.-')(k.a.-k.a.-')]")

for pm in pl:
    print(pm)


b.-S:.A:.-'S:.-'S:.-',
E:.wo.- E:S:.-d.u.-'
k.a.-k.a.-'
E:.wo.- E:S:.-d.u.-'

In [8]:
# parse all words
usls = db.list(parse=False, type='word')
usls


Out[8]:
["[! E:A:.  (E:.wo.- E:S:.-d.u.-')(b.-S:.A:.-'T:.-'T:.-',)]",
 "[! E:A:.  (E:U:A:. E:.wo.- E:S:.-d.u.-')(s.e.-k.u.-wa.e.-')]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(b.-S:.A:.-'S:.-'S:.-',) > E:A:. E:A:. (E:.wo.- E:S:.-d.u.-')(k.a.-k.a.-')]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(f.i.-b.i.-')]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(a.)]",
 "[! E:A:.  (E:U:A:. E:.wo.- E:S:.-d.u.-')(f.u.-wu.f.U:.-')]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(k.x.-) > E:A:. E:A:. (E:.wo.- E:S:.-d.u.-')(t.i.-s.i.-'u.B:.-U:.-'wa.-',)]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(k.i.-l.i.-')]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(m.-B:.A:.-') > E:A:. E:A:. (E:.wo.- E:B:.-d.u.-')(p.E:A:T:.-)]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(wa.)]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(m.-T:.U:.-') > E:A:. E:U:. (E:B:.-d.u.-')(p.E:A:T:.-)]",
 "[! E:A:.  (E:U:A:. E:.wo.- E:S:.-d.u.-')(f.u.-wu.f.S:.-')]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(l.-y.-'E:U:.t.-l.-'E:U:.t.-l.-',)]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(k.a.-) > E:A:. E:A:. (E:.wo.- E:S:.-d.u.-')(t.i.-s.i.-'u.B:.-U:.-'wa.-',)]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(E:S:T:.)]",
 "[! E:A:.  (E:.wo.- E:S:.-d.u.-')(E:.A:.j.-)]",
 "[E:T:. (E:.b.wa.- E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(e.) > E:.n.- (E:.wo.- E:S:.-d.u.-') > E:.d.- (E:.wo.- E:S:.-d.u.-')(m.-S:.U:.-') > ! E:.n.- E:U:. ()]",
 "[E:T:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(a.T:.-) > ! E:.l.- (E:.wo.- E:S:.-d.u.-')]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(t.e.-f.u.-')]",
 "[! E:T:. (E:.b.i.- E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(E:S:.h.-)]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(b.-S:.A:.-')]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(i.) > E:.n.- (E:.wo.- E:S:.-d.u.-')(t.i.-s.i.-'u.T:.-U:.-'we.-',B:.-',_B:.-',_;) > E:.f.- (E:U:S:. E:.wo.- E:S:.-d.u.-')]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(a.B:.-) > E:.f.- (E:A:S:. E:.wo.- E:S:.-d.u.-')]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(l.i.-n.i.-')]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(a.T:.-)]",
 "[! E:T:. (E:.-wo.-t.o.-' E:.-'we.-S:.-'t.o.-',)(t.)]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(a.T:.-) > E:.f.- (E:.wo.- E:S:.-d.u.-')(E:T:.-t.u.-')]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(s.a.-d.a.-')]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(i.S:.-)]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(t.)]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(wu.f.B:.-) > E:.d.- (E:.wo.- E:S:.-d.u.-')(f.-S:.A:.-')]",
 "[! E:T:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(b.-T:.A:.-')]",
 "[! E:T:. (E:.-wo.-t.o.-' E:.-'we.-S:.-'t.o.-',)(s.a.-d.a.-')]",
 "[! E:B:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.a.-) > E:.s.- (E:.wo.- E:T:.c.- E:S:.-d.u.-')(p.we.-)]",
 "[! E:B:. (E:.b.wa.- E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(we.)]",
 "[! E:B:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(e.c.-) > E:.d.- (E:.wo.- E:S:.-d.u.-')(t.i.-s.i.-')]",
 "[! E:B:. (E:.b.i.- E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(a.T:.-)]",
 "[! E:B:. (E:.b.wa.- E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(we.) > E:.d.- (E:.wo.- E:S:.-d.u.-')(m.-T:.U:.-')]",
 "[E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.t.- (E:.wo.- E:S:.-d.u.-')(S:.E:A:T:.-) > ! E:.n.- (E:.wo.- E:S:.-d.u.-')(l.-T:.U:.-',n.-T:.A:.-',t.o.-f.o.-',_) > E:.f.- (E:.wo.- E:S:.-d.u.-')(n.i.-d.i.-t.u.-') > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')(n.-T:.U:.-')]",
 "[E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.t.- (E:.wo.- E:S:.-d.u.-')(p.E:S:B:.-) > ! E:.n.- (E:.wo.- E:S:.-d.u.-')(l.-T:.U:.-',n.-T:.A:.-',t.o.-f.o.-',_) > E:.f.- (E:.wo.- E:S:.-d.u.-')(n.i.-d.i.-t.u.-') > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')(n.-T:.U:.-')]",
 "[E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > ! E:.n.- (E:.wo.- E:S:.-d.u.-')(l.-T:.U:.-',n.-T:.A:.-',t.o.-f.o.-',_) > E:.f.- (E:.wo.- E:S:.-d.u.-')(n.i.-d.i.-t.u.-') > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')(n.-T:.U:.-')]",
 "[E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.S:.-) > ! E:.s.- (E:.wa.- E:S:.-d.u.-')(E:T:.x.-)]",
 "[E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.s.- (E:.wo.- E:T:.h.- E:S:.-d.u.-')(s.j.- d.-S:.U:.-') > ! E:.n.- (E:.wo.- E:S:.-d.u.-')(l.-T:.U:.-',n.-T:.A:.-',t.o.-f.o.-',_) > E:.f.- (E:.wo.- E:S:.-d.u.-')(n.i.-d.i.-t.u.-') > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')(n.-T:.U:.-')]",
 "[E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.t.- (E:.wo.- E:S:.-d.u.-')(S:.E:A:S:.-) > ! E:.n.- (E:.wo.- E:S:.-d.u.-')(l.-T:.U:.-',n.-T:.A:.-',t.o.-f.o.-',_) > E:.f.- (E:.wo.- E:S:.-d.u.-')(n.i.-d.i.-t.u.-') > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')(n.-T:.U:.-')]",
 "[! E:U:.  (E:.U:.c.-)(f.a.-m.a.-')]",
 "[! E:U:.  (E:A:T:. E:B:.-d.u.-')(m.-T:.U:.-')]",
 "[! E:U:.  (E:.U:.j.-)(n.i.-d.i.-t.u.-')]",
 "[! E:U:.  (E:A:T:.)(t.o.-p.-')]",
 "[! E:U:.  (E:U:S:.)(f.i.-b.i.-')]",
 '[! E:U:.  (E:A:T:.)(p.E:A:T:.-)]',
 "[! E:U:.  (E:.A:.c.-)(f.a.-m.a.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:S:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.s.- (E:.wo.- E:T:.x.- E:S:.-d.u.-')(b.i.-n.i.-'l.i.-f.i.-'n.-B:.U:.-',) > E:.f.- (E:.wo.- E:S:.-d.u.-')(l.o.-m.o.-s.u.-') > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')(l.-y.-'E:U:.n.-l.-'E:U:.s.-l.-',)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.f.- (E:.wo.- E:S:.-d.u.-')(l.o.-m.o.-s.u.-') > E:.l.- (E:.wo.- E:.-U:.s.-l.-' E:S:.-d.u.-')(n.-T:.U:.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(wa.) > E:.n.- (E:.wo.- E:S:.-d.u.-')(n.i.-s.i.-') > E:.f.- (E:U:S:. E:.wo.- E:S:.-d.u.-')]",
 "[! E:S:. (E:.b.we.- E:.-wa.-t.o.-' E:S:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(n.u.-s.u.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:S:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.s.- (E:.wo.- E:T:.x.- E:S:.-d.u.-')(n.i.-f.i.-') > E:.f.- (E:.U:.j.- E:.wo.- E:S:.-d.u.-')(l.o.-m.o.-s.u.-') > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')(n.-T:.A:.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(b.-S:.A:.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:S:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.s.- (E:.wo.- E:T:.x.- E:S:.-d.u.-')(n.i.-f.i.-') > E:.f.- (E:.wo.- E:S:.-d.u.-')(l.o.-m.o.-s.u.-') > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')(n.-T:.U:.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(i.S:.-)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(wa.wo.t.-) > E:.s.- (E:.wo.- E:T:.c.- E:S:.-d.u.-')(s.c.we.-)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(b.-T:.A:.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:B:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(A:.a.-) > E:.d.- (E:.wo.- E:S:.-d.u.-')(l.j.-)]",
 "[! E:S:. (E:.b.wa.- E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(m.-T:.A:.-'m.-S:.U:.-'E:A:T:.-',)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(s.c.-)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.l.- (E:.wo.- E:.-A:.d.-l.-' E:S:.-d.u.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-B:.-'t.o.-',)(a.u.-)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.s.- (E:.wo.- E:T:.x.- E:S:.-d.u.-')(B:.B:.n.-k.-u.T:.-') > E:.f.- (E:.wo.- E:S:.-d.u.-')(i.c.-) > E:.l.- (E:.wo.- E:.-U:.s.-l.-' E:S:.-d.u.-')(l.-y.-'E:U:.n.-l.-'E:U:.s.-l.-',)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(s.we.-)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:T:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.s.- (E:.wo.- E:T:.x.- E:S:.-d.u.-')(t.i.-s.i.-'u.S:.-U:.-'wa.-',) > E:.f.- (E:.U:.j.- E:.wo.- E:S:.-d.u.-')(l.o.-m.o.-s.u.-') > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')(n.-T:.U:.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.l.- (E:.wo.- E:.-U:.s.-l.-' E:S:.-d.u.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(we.) > E:.f.- (E:.U:.j.- E:.wo.- E:S:.-d.u.-')]",
 "[! E:S:. (E:.b.wa.- E:.-wa.-t.o.-' E:T:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(m.-B:.A:.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(l.-T:.U:.-',n.-T:.A:.-',t.o.-f.o.-',_)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.l.- (E:.wo.- E:.-A:.s.-l.-' E:S:.-d.u.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(b.-S:.A:.-'T:.-'T:.-',)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(wo.) > E:.l.- (E:.wo.- E:.-B:.k.-l.-' E:S:.-d.u.-') > E:.l.- E:A:. (E:.wo.- E:S:.-d.u.-')(m.-T:.A:.-'m.-S:.U:.-'E:A:T:.-',)]",
 "[! E:S:. (E:S:U:. E:.b.wa.- E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(s.)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(wo.) > E:.n.- (E:.wo.- E:S:.-d.u.-')(f.i.-k.i.-') > E:.f.- (E:U:S:. E:.wo.- E:S:.-d.u.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:S:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.s.- (E:.wo.- E:T:.x.- E:S:.-d.u.-')(t.i.-s.i.-'u.S:.-U:.-'wa.-',) > E:.f.- (E:.U:.j.- E:.wo.- E:S:.-d.u.-')(l.o.-m.o.-s.u.-') > E:.l.- (E:.wo.- E:.-U:.s.-l.-' E:S:.-d.u.-')(n.-T:.U:.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(wa.) > E:.n.- (E:.wo.- E:S:.-d.u.-')(n.i.-s.i.-') > E:.f.- (E:.wo.- E:S:.-d.u.-' E:T:.-t.u.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.s.- (E:.wo.- E:T:.x.- E:S:.-d.u.-')(n.i.-f.i.-') > E:.f.- (E:.wo.- E:S:.-d.u.-')(i.c.-) > E:.l.- (E:.wo.- E:.-U:.s.-l.-' E:S:.-d.u.-')(l.-y.-'E:U:.n.-l.-'E:U:.s.-l.-',)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:S:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(e.U:.-)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:T:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(A:.a.-) > E:.d.- (E:.wo.- E:S:.-d.u.-')(l.j.-)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:B:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(e.U:.-)]",
 "[! E:S:. (E:.b.wa.- E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(f.o.-d.o.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:S:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.s.- (E:.wo.- E:T:.x.- E:S:.-d.u.-')(n.i.-f.i.-') > E:.f.- (E:.wo.- E:S:.-d.u.-')(n.i.-d.i.-t.u.-') > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')(n.-T:.U:.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:T:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(e.U:.-)]",
 "[! E:S:. (E:.-wa.-t.o.-' E:S:.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(u.A:.-) > E:.s.- (E:.wo.- E:T:.x.- E:S:.-d.u.-')(n.i.-f.i.-') > E:.f.- (E:.wo.- E:S:.-d.u.-')(l.o.-m.o.-s.u.-') > E:.l.- (E:.wo.- E:.-U:.d.-l.-' E:S:.-d.u.-')(n.-T:.A:.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(m.a.-f.a.-')]",
 "[! E:S:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(E:S:.h.-)]",
 "[! E:S:. (E:.b.o.- E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(wa.we.t.-) > E:.s.- (E:.wo.- E:T:.c.- E:S:.-d.u.-')(m.u.-)]",
 "[E:B:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(i.k.-) > ! E:.n.- (E:.wo.- E:.-n.S:.-' E:S:.-d.u.-')(t.a.-b.a.-f.o.-')]",
 "[E:B:. (E:.-wa.-t.o.-' E:.-'wu.-S:.-'t.o.-',)(e.) > ! E:.n.- (E:.wo.- E:S:.-d.u.-') > E:.d.- (E:.wo.- E:S:.-d.u.-')(m.-S:.U:.-')]",
 "[E:B:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(i.k.-) > ! E:.k.- (E:.wo.- E:.-n.S:.-' E:S:.-d.u.-')]",
 "[E:B:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(i.k.-) > ! E:.n.- (E:.wo.- E:.-n.S:.-' E:S:.-d.u.-')]",
 "[E:B:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(i.k.-) > ! E:.d.- (E:.wo.- E:S:.-d.u.-')]",
 "[E:B:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(i.k.-) > ! E:.d.- (E:.wo.- E:.-n.E:U:.-' E:S:.-d.u.-')(t.e.-n.u.-')]",
 "[E:B:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(e.i.-) > ! E:.n.- (E:.wo.- E:S:.-d.u.-')]",
 "[E:B:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(i.k.-) > E:.k.- (E:.wo.- E:.-n.S:.-' E:S:.-d.u.-')(b.a.-b.a.-f.o.-') > E:.n.- (E:.wo.- E:.-n.S:.-' E:S:.-d.u.-')(t.a.-b.a.-f.o.-') > ! E:.d.- (E:.wo.- E:.-n.E:U:.-' E:S:.-d.u.-')(t.e.-n.u.-')]",
 "[E:B:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(i.k.-) > ! E:.k.- (E:.wo.- E:.-n.S:.-' E:S:.-d.u.-')(b.a.-b.a.-f.o.-')]",
 "[E:B:. (E:.-wa.-t.o.-' E:.-'we.-S:.-'t.o.-',)(e.i.-) > ! E:.k.- (E:.wo.- E:S:.-d.u.-')]",
 "[E:A:.  (E:.wo.- E:.-n.S:.-' E:S:.-d.u.-')(b.a.- b.o.-n.o.-s.u.-' f.a.-b.a.-f.o.-') > ! E:A:. E:U:. () > E:A:. E:A:. (E:.wo.- E:S:.-d.u.-')(n.-S:.U:.-'B:.-'B:.-',B:.-',B:.-',_ n.-S:.U:.-'B:.-'B:.-',T:.-',S:.-',_)]"]

In [3]:
from ieml.usl import USL
from ieml.dictionary.script import Script

# the database contains the morphemes and the usls made from morphemes
all(isinstance(u, (USL, Script)) for u in usls)


Out[3]:
True

In [35]:
descriptorsDB = db.get_descriptors()
def display_usls(u):
    descriptor = descriptorsDB.get_values_partial(u)
    # descriptor is a dict :
    # { (ieml, descriptor_type, lang) : string[]}
    # descriptor_type in ieml.constants.DESCRIPTORS_CLASS = ['translations', 'comments', 'tags']
    # lang in ieml.constants.LANGUAGES = [ 'fr', 'en' ]  
    
    return str(u) +\
        "".join("\n\t{}: {}".format(k, str(v)) for k, v in {
            **{'{}_{}'.format(descriptor_type, lang): ', '.join(t) 
               for (_, descriptor_type, lang), t in descriptor.items()},
            'type': u.__class__.__name__,
            'is_paradigm': not u.is_singular,
            
        }.items())

In [36]:
from ieml.usl.usl import usl

# usl() parse the string and return an Usl or a Script (if a morpheme)
oo_script = usl('O:O:.')
assert isinstance(oo_script, Script)

print(display_usls(usl('O:O:.')))


O:O:.
	en_comments: In order to understand O x O we have to think about the basic sensorimotor cycle. Let's begin with the inner sanctum of personal existence that does not manifest externally: to exist. Then, from this virtual place, we act. As a result, our actual environment is transformed and a new reality appears or happens. Finally, from the actuality of external happening, we perceive back to our inner existence. Note the two intertwined oppositions : \n\n• wa act (in –> out) / wu perceive (out –> in) \n\n• wo exist (in –> in) / we appear (out –> out)\n\nwo wa wu we can be used to model any quaternary semantic symmetry. They can also be used to « verbify » nominal semes when creating new words.
	en_translations: interaction phases, tetrad
	fr_translations: phases de l'interaction, tétrade
	type: MultiplicativeScript
	is_paradigm: True

In [ ]: