Package: pyigt
pyigt: Handling interlinear glossed text with PythonThis library provides easy access toInterlinearGlossedText (IGT) according
to theLeipzig Glossing Rules, stored asCLDF examples.InstallationInstallingpyigtvia pippipinstallpyigtwill install the Python package along with acommand line interfaceigt.Note: The methodsCorpus.get_wordlistandCorpus.get_profile, to extract a wordlist and an orthography profile
from a corpus, require thelingpypackage. To make sure it is installed, installpyigtaspipinstallpyigt[lingpy]CLI$igt-h
usage:igt[-h][--log-levelLOG_LEVEL]COMMAND...

optionalarguments:-h,--helpshowthishelpmessageandexit--log-levelLOG_LEVELloglevel[ERROR|WARN|INFO|DEBUG](default:20)availablecommands:Run"COMAMND -h"togethelpforaspecificcommand.COMMANDlsListIGTsinaCLDFdatasetstatsDescribetheIGTsinaCLDFdatasetTheigt lscommand allows inspecting IGTs from the commandline, formatted using the
four standard lines described in the Leipzig Glossing Rules, where analyzed text and
glosses are aligned, e.g.$igtlstests/fixtures/examples.csvExample1:
zəple:ȵike:pejiqeʴlotʂuʁɑ,
zəp-le:ȵi-ke:pe-jiqeʴlotʂu-ʁɑ,
earth-DEF:CLWH-INDEF:CLbecome-CSMin.the.past-LOC

...

Example5:
zuɑməɸuoʐgutɑipiχuɑȵi,
zuɑmə-ɸuo-ʐgu-tɑi-pi-χuɑ-ȵi,
cypress-treeone-CL-LOCDIR-hide-because-ADV

IGTcorpusattests/fixtures/examples.csvigt lscan be chained with other commandline tools such as commands from thecsvkitpackage for filtering:$csvgrep-cPrimary_Text-m"ȵi"tests/fixtures/examples.csv|csvgrep-cGloss-m"ADV"|igtls-
Example5:
zuɑməɸuoʐgutɑipiχuɑȵi,
zuɑmə-ɸuo-ʐgu-tɑi-pi-χuɑ-ȵi,
cypress-treeone-CL-LOCDIR-hide-because-ADVPython APIThe Python API is documented in detail atreadthedocs.
Below is a quick overview.You can read all IGT examples provided with a CLDF dataset>>>frompyigtimportCorpus>>>corpus=Corpus.from_path('tests/fixtures/cldf-metadata.json')>>>len(corpus)5>>>forigtincorpus:...print(igt)...break...zəple:ȵike:pejiqeʴlotʂuʁɑ,zəp-le:ȵi-ke:pe-jiqeʴlotʂu-ʁɑ,earth-DEF:CLWH-INDEF:CLbecome-CSMin.the.past-LOCor instantiate individual IGT examples, e.g. to check for validity:>>>frompyigtimportIGT>>>ex=IGT(phrase="palasi=lu",gloss="priest-and")>>>ex.check(strict=True,verbose=True)palasi=lupriest-and...ValueError:Rule2violated:Numberofmorphemesdoesnotmatchnumberofmorphemeglosses!or to expand known gloss abbreviations:>>>ex=IGT(phrase="Gila abur-u-n ferma hamišaluǧ güǧüna amuq’-da-č.",...gloss="now they-OBL-GEN farm forever behind stay-FUT-NEG",...translation="Now their farm will not stay behind forever.")>>>ex.pprint()Gilaaburunfermahamišaluǧgüǧünaamuq’dač.Gilaabur-u-nfermahamišaluǧgüǧünaamuq’-da-č.nowthey-OBL-GENfarmforeverbehindstay-FUT-NEG‘Nowtheirfarmwillnotstaybehindforever.’OBL=obliqueGEN=genitiveFUT=futureNEG=negation,negativeAnd you can go deeper, parsing morphemes and glosses according to the LGR
(see modulepyigt.lgrmorphemes):>>>igt=IGT(phrase="zəp-le: ȵi-ke: pe-ji qeʴlotʂu-ʁɑ,",gloss="earth-DEF:CL WH-INDEF:CL become-CSM in.the.past-LOC")>>>igt.conformance<LGRConformance.MORPHEME_ALIGNED:2>>>>igt[1,1].gloss<Morpheme"INDEF:CL">>>>igt[1,1].gloss.elements[<GlossElement"INDEF">,<GlossElementAfterColon"CL">]>>>igt[1,1].morpheme<Morpheme"ke:">>>>print(igt[1,1].morpheme)ke:See alsointerlineaR- an R package with similar functionality, but support for more input formats.