python package for glottolog data curation
Project description
pyglottolog
Programmatic access to Glottolog data.
Install
To install pyglottolog you need a python installation on your system, running python 2.7 or >3.4. Run
pip install pyglottolog
This will also install the command line interface glottolog.
Note: To make use of pyglottolog you also need a local copy of the
Glottolog data. This can be
- a clone of the clld/glottolog repository or your fork of it,
- an unzipped released version of Glottolog from GitHub,
- or an unzipped download of a released version of Glottolog from ZENODO.
Make sure you remember where this local copy of the data is located - you always
have to pass this location as argument when using pyglottolog.
Python API
Glottolog data can also be accessed programmatically from within python programs.
All functionality is mediated through an instance of pyglottolog.api.Glottolog, e.g.
>>> from pyglottolog.api import Glottolog
>>> api = Glottolog('.')
>>> print(api)
<Glottolog repos v0.2-259-g27ac0ef at /.../glottolog>
Accessing languoid data
>>> api.languoid('stan1295')
<Language stan1295>
>>> print(api.languoid('stan1295'))
German [stan1295]
Accessing reference data
>>> print(api.bibfiles['hh.bib']['s:Karang:Tati-Harzani'])
@book{s:Karang:Tati-Harzani,
author = {'Abd-al-'Ali Kārang},
title = {Tāti va Harzani},
publisher = {Tabriz: Tabriz University Press},
address = {Tabriz},
pages = {6+160},
year = {1334 [1953]},
glottolog_ref_id = {41999},
hhtype = {grammar_sketch},
inlg = {Farsi [pes]},
lgcode = {Harzani [hrz]},
macro_area = {Eurasia}
}
Command line interface
Command line functionality is implemented via sub-commands of glottolog. The list of
available sub-commands can be inspected running
$ glottolog --help
usage: glottolog [-h] [--verbosity VERBOSITY] [--log-level LOG_LEVEL]
[--repos REPOS]
command ...
Main command line interface of the pyglottolog package.
positional arguments:
command isobib | show | edit | create | bib | tree | newick |
index | check | metadata | refsearch | refindex |
langsearch | langindex | tree2lff | lff2tree
args
optional arguments:
-h, --help show this help message and exit
--verbosity VERBOSITY
increase output verbosity
--log-level LOG_LEVEL
log level [ERROR|WARN|INFO|DEBUG]
--repos REPOS path to glottolog data repository
Use 'glottolog help <cmd>' to get help about individual commands.
Note: The location of your local clone or export of the Glottolog data should
be passed as --repos=PATH/TO/glottolog.
Extracting languoid data
Glottolog data is often integrated with other data or incorporated as reference data in tools, e.g. as LanguageTable in a CLDF dataset.
To make this easier, pyglottolog provides the languoids subcommand, which
dumps basic languoid data into a CSVW file with accompanying metadata:
glottolog --repos=PATH/TO/glottolog languoids [--output=OUTDIR] [--version=VERSION]
This will create a CSVW package, i.e.
- a CSV table
glottolog-languoids-VERSION.csv - and a JSON description
glottolog-languoids-VERSION.csv-metadata.json
where VERSION is the result of running git describe on the data repository,
or the version string passed as--version=VERSION in case you are running the command
on an export of the repository or a download from ZENODO.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyglottolog-1.5.0.tar.gz.
File metadata
- Download URL: pyglottolog-1.5.0.tar.gz
- Upload date:
- Size: 68.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ab1f1c287f4ca8b0345e7d68bfb31ee425034e8a8498618c2546f180282e3c8
|
|
| MD5 |
90b84564b03921ae887abd414478427d
|
|
| BLAKE2b-256 |
c51f130f490590522097704bb3533690a8f21d447a9bc2d71c32b1b7de06d805
|
File details
Details for the file pyglottolog-1.5.0-py2.py3-none-any.whl.
File metadata
- Download URL: pyglottolog-1.5.0-py2.py3-none-any.whl
- Upload date:
- Size: 60.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6cbd2a7b5150982a209e8ff5029187091a2a5fe78134a9ecd81e419bf67c8a4
|
|
| MD5 |
1647dbea504ddbf4fcda9584f2b8ba29
|
|
| BLAKE2b-256 |
6d4f551a0f36d160221e4dd320c79bf80a4c6077a1f9b3bd01d41a18bcc8ac6b
|