A Python library for handling inter-linear-glossed text.
Project description
pyigt: Handling interlinear glossed text with Python
This library provides easy access to Interlinear Glossed Text (IGT) according to the Leipzig Glossing Rules, stored as CLDF examples.
Installation
Installing pyigt
via pip
pip install pyigt
will install the Python package along with a command line interface igt
.
Usage
CLI
$ igt -h
usage: igt [-h] [--log-level LOG_LEVEL] COMMAND ...
optional arguments:
-h, --help show this help message and exit
--log-level LOG_LEVEL
log level [ERROR|WARN|INFO|DEBUG] (default: 20)
available commands:
Run "COMAMND -h" to get help for a specific command.
COMMAND
ls List IGTs in a CLDF dataset
stats Describe the IGTs in a CLDF dataset
The igt ls
command 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.
$ igt ls tests/fixtures/examples.csv
Example 1:
zəple: ȵike: peji qeʴlotʂuʁɑ,
zəp-le: ȵi-ke: pe-ji qeʴlotʂu-ʁɑ,
earth-DEF:CL WH-INDEF:CL become-CSM in.the.past-LOC
...
Example 5:
zuɑməɸu oʐgutɑ ipiχuɑȵi,
zuɑmə-ɸu o-ʐgu-tɑ i-pi-χuɑ-ȵi,
cypress-tree one-CL-LOC DIR-hide-because-ADV
IGT corpus at tests/fixtures/examples.csv
igt ls
can be chained with other commandline tools such as commands from the
csvkit package for filtering:
$ csvgrep -c Primary_Text -m"ȵi" tests/fixtures/examples.csv | csvgrep -c Gloss -m"ADV" | igt ls -
Example 5:
zuɑməɸu oʐgutɑ ipiχuɑȵi,
zuɑmə-ɸu o-ʐgu-tɑ i-pi-χuɑ-ȵi,
cypress-tree one-CL-LOC DIR-hide-because-ADV
Python API
>>> from pyigt import Corpus
>>> corpus = Corpus.from_path('tests/fixtures/cldf-metadata.json')
>>> len(corpus)
>>> len(corpus)
5
>>> for igt in corpus:
... print(igt)
... break
...
zəple: ȵike: peji qeʴlotʂuʁɑ,
zəp-le: ȵi-ke: pe-ji qeʴlotʂu-ʁɑ,
earth-DEF:CL WH-INDEF:CL become-CSM in.the.past-LOC
See also
- interlineaR - an R package with similar functionality, but support for more input formats.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyigt-1.1.0.tar.gz
(24.4 kB
view hashes)
Built Distribution
pyigt-1.1.0-py2.py3-none-any.whl
(24.6 kB
view hashes)
Close
Hashes for pyigt-1.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fe2ed143b2579105acc14b2898eb244c87ff51fbfb4565b4a3171ffceac4205 |
|
MD5 | b1479e0a80bf380a91f1d62ffc716e55 |
|
BLAKE2b-256 | ddea97319d13d45539e0d01682f985e2fcf7749ba948314cbda47295c2b8f840 |