https://github.com/cldf/pyigt

Handling Interlinear Glossed Text in python

https://github.com/cldf/pyigt

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.5%) to scientific vocabulary

Keywords from Contributors

linguistics concepts cross-linguistic-data
Last synced: 11 months ago · JSON representation

Repository

Handling Interlinear Glossed Text in python

Basic Info
  • Host: GitHub
  • Owner: cldf
  • License: gpl-3.0
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 260 KB
Statistics
  • Stars: 7
  • Watchers: 6
  • Forks: 1
  • Open Issues: 0
  • Releases: 5
Created over 6 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog Contributing License

README.md

pyigt: Handling interlinear glossed text with Python

Build Status PyPI Documentation Status

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

shell pip install pyigt will install the Python package along with a command line interface igt.

Note: The methods Corpus.get_wordlist and Corpus.get_profile, to extract a wordlist and an orthography profile from a corpus, require the lingpy package. To make sure it is installed, install pyigt as shell pip install pyigt[lingpy]

CLI

```shell script $ 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

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. ```shell script $ 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: ```shell script $ 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

The Python API is documented in detail at readthedocs. Below is a quick overview.

You can read all IGT examples provided with a CLDF dataset

```python

from pyigt import Corpus corpus = Corpus.from_path('tests/fixtures/cldf-metadata.json') 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 ```

or instantiate individual IGT examples, e.g. to check for validity: ```python

from pyigt import IGT ex = IGT(phrase="palasi=lu", gloss="priest-and") ex.check(strict=True, verbose=True) palasi=lu priest-and ... ValueError: Rule 2 violated: Number of morphemes does not match number of morpheme glosses! or to expand known gloss abbreviations: python 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() Gila aburun ferma hamišaluǧ güǧüna amuq’dač. Gila abur-u-n ferma hamišaluǧ güǧüna amuq’-da-č. now they-OBL-GEN farm forever behind stay-FUT-NEG ‘Now their farm will not stay behind forever.’ OBL = oblique GEN = genitive FUT = future NEG = negation, negative ```

And you can go deeper, parsing morphemes and glosses according to the LGR (see module pyigt.lgrmorphemes):

```python

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 igt[1, 1].gloss igt[1, 1].gloss.elements [, ] igt[1, 1].morpheme print(igt[1, 1].morpheme) ke: ```

See also

  • interlineaR - an R package with similar functionality, but support for more input formats.

Owner

  • Name: Cross-Linguistic Data Formats
  • Login: cldf
  • Kind: organization

GitHub Events

Total
  • Push event: 8
  • Create event: 1
Last Year
  • Push event: 8
  • Create event: 1

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 55
  • Total Committers: 3
  • Avg Commits per committer: 18.333
  • Development Distribution Score (DDS): 0.073
Top Committers
Name Email Commits
xrotwang x****g@g****m 51
lingulist m****t@l****g 2
lingulist m****t@l****e 2
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 15
  • Total pull requests: 5
  • Average time to close issues: 3 months
  • Average time to close pull requests: 8 days
  • Total issue authors: 3
  • Total pull request authors: 2
  • Average comments per issue: 2.8
  • Average comments per pull request: 10.6
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • xrotwang (8)
  • fmatter (6)
  • dwhieb (1)
Pull Request Authors
  • xrotwang (4)
  • LinguList (1)
Top Labels
Issue Labels
wontfix (1) bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 8,680 last-month
  • Total dependent packages: 3
  • Total dependent repositories: 5
  • Total versions: 11
  • Total maintainers: 3
pypi.org: pyigt

A Python library for handling inter-linear-glossed text.

  • Versions: 11
  • Dependent Packages: 3
  • Dependent Repositories: 5
  • Downloads: 8,680 Last month
Rankings
Dependent packages count: 2.3%
Dependent repos count: 6.6%
Downloads: 10.7%
Average: 12.8%
Stargazers count: 21.5%
Forks count: 22.6%
Maintainers (3)
Last synced: 11 months ago

Dependencies

.github/workflows/python-package.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
docs/requirements.txt pypi
  • sphinx-autodoc-typehints *
  • sphinx-rtd-theme *
pyproject.toml pypi
requirements.txt pypi
setup.py pypi