Package: elotl
Py-ElotlPython package for Natural Language Processing (NLP), focused on low-resource languages spoken in Mexico.This is a project ofComunidad Elotl.Developed by:Paul Aguilar@penserbjorne,paul.aguilar.enriquez@hotmail.comRobert Pugh@Lguyogiro,robertpugh408@gmail.comRequiere python>=3.XDevelopment StatusPre-Alpha. ReadClassifierspip package:elotlGitHub repository:ElotlMX/py-elotlInstallationUsingpippipinstallelotlFrom sourcegitclonehttps://github.com/ElotlMX/py-elotl.gitcdpy-elotl
pipinstall-e.UseWorking with corpusimportelotl.corpusListing available corpusCode:print("Name\t\tDescription")list_of_corpus=elotl.corpus.list_of_corpus()forrowinlist_of_corpus:print(row)Output:NameDescription['axolotl','Is a Spanish-Nahuatl parallel corpus']['tsunkua','Is a Spanish-otomí parallel corpus']Loading a corpusIf a non-existent corpus is requested, a value of 0 is returned.axolotl=elotl.corpus.load('axolotlr')ifaxolotl==0:print("The name entered does not correspond to any corpus")If an existing corpus is entered, a list is returned.axolotl=elotl.corpus.load('axolotl')forrowinaxolotl:print(row)['Hay que adivinar: un pozo, a la mitad del cerro, te vas a encontrar.','See tosaasaanil, see tosaasaanil. Tias iipan see tepeetl, iitlakotian tepeetl, tikoonextis san see aameyalli.','','Adivinanzas nahuas']Each element of the list has four indices:non_original_languageoriginal_languagevariantdocument_nametsunkua=elotl.corpus.load('tsunkua')forrowintsunkua:print(row[0])# language 1print(row[1])# language 2print(row[2])# variantprint(row[3])# documentUnavezunaseñoraseemborrachó
nándinarat'u̱xúbintí
OtomídelEstadodeMéxico(ots)Elotomídetoluca,YolandaLastraNormalizing nahuatl orthographiesImport the orthography module and Load the axolot nahuatl corpus.importelotl.corpusimportelotl.nahuatl.orthographya=elotl.corpus.load("axolotl")Creates a normalizer object, passing as parameter the normalization to be used.The following normalizations are currently available:sepAlphabet often seen in use by the Secretaría de Educación Pública (SEP) and the Instituto Nacional para la Educación de los Adultos (INEA). important characteristics of this alphabet are the use of "u" for the phoneme /w/, "k" for /k/, and "j" for /h/.inaliAlphabet in use by the Instituto Nacional de Lenguas Indígenas. Uses "w" for /w/, "k" for /k/, and "h" for /h/.ackAlphabet initially used by Richard Andrews and subsequently by a number of other Nahuatl scholars. Named after Andrews, Campbell, and Karttunen. Uses "hu" for /w/, "c" and "qu" for /k/, and "h" for /h/.If an unsupported normalization is specified, sep will be used by default.You can use thenormalizemethod to normalize a text to the selected orthography. And theto_phonesmethod to get
the phonemes.>>>n=elotl.nahuatl.orthography.Normalizer("sep")>>>n.normalize(a[1][1])'au in ye yujki in on tlenamakak niman ye ik teixpan on motlalia se tlakatl itech mokaua.'>>>n.to_phones(a[1][1])'aw in ye yuʔki in on ƛenamakak niman ye ik teiʃpan on moƛalia se ƛakaƛ itet͡ʃ mokawa.'>>>n=elotl.nahuatl.orthography.Normalizer("inali")>>>n.normalize(a[1][1])'aw in ye yuhki in on tlenamakak niman ye ik teixpan on motlalia se tlakatl itech mokawa.'>>>n.to_phones(a[1][1])'aw in ye yuʔki in on ƛenamakak niman ye ik teiʃpan on moƛalia se ƛakaƛ itet͡ʃ mokawa.'>>>n=elotl.nahuatl.orthography.Normalizer("ack")>>>n.normalize(a[1][1])'auh in ye yuhqui in on tlenamacac niman ye ic teixpan on motlalia ce tlacatl itech mocahua.'>>>n.to_phones(a[1][1])'aw in ye yuʔki in on ƛenamakak niman ye ik teiʃpan on moƛalia se ƛakaƛ itet͡ʃ mokawa.'Package structureThe following structure is a reference. As the package grows it will be better documented.elotl/                              Top-level package
          __init__.py               Initialize the package
          corpora/                  Here are the corpus data
          corpus/                   Subpackage to load corpus     
          nahuatl/                  Nahuatl language subpackage
                  orthography.py    Module to normalyze nahuatl orthography and phonemas
          utils/                    Subpackage with useful functions and files
                  fst/              Finite State Transducer functions
                        att/        Module with static .att files
test/                               Unit test scriptsDevelopmentRequirementspython3HFSTGNU makevirtualenvPython packagessetuptoolswheelQuick buildvirtualenv--python=/usr/bin/python3venvsourcevenv/bin/activate
makeallStep by stepBuild FSTsBuild the FSTs withmake.makefstCreate a virtual environment and activate it.virtualenv--python=/usr/bin/python3venvsourcevenv/bin/activateUpdatepipand generate distribution files.python-mpipinstall--upgradepip
python-mpipinstall--upgradesetuptoolswheel
rm-rfbuild/dist/
pythonsetup.pycleansdistbdist_wheelTesting the package locallypython-mpipinstall-e.Send to PyPIpython-mpipinstalltwine
twineuploaddist/*LicenseMozilla Public License 2.0 (MPL 2.0)Referenceshttps://elotl.mx/Packaging Python ProjectsHow To Package Your Python CodeMaking a Python Package