Skip to main content

programmatic curation of concepticon-data

Project description

pyconcepticon

Tooling to access and curate Concepticon data.

Build Status PyPI

Installation

pyconcepticon can be installed from PyPI running

pip install pyconcepticon

Note that pyconcepticon requires a clone or export of the concepticon data repository.

Usage

To use pyconcepticon you must have a local copy of the Concepticon data, i.e. either

  • the sources of a released version, as provided in the Downloads section of a release, or
  • a clone of this repository (or your personal fork of it).
  • or a released version of the data as archived on ZENODO.

Python API

Assuming you have downloaded release 1.2.0 DOI and unpacked the sources to a directory clld-concepticon-data-41d2bf0, you can access the data as follows:

>>> from pyconcepticon import Concepticon
>>> api = Concepticon('clld-concepticon-data-41d2bf0')
>>> conceptlist = list(api.conceptlists.values())[0]
>>> conceptlist.author
'Perrin, Loïc-Michel'
>>> conceptlist.tags
['annotated']
>>> len(conceptlist.concepts)
110
>>> list(conceptlist.concepts.values())[0]
Concept(
    id='Perrin-2010-110-1', number='1', concepticon_id='1906', concepticon_gloss='SOUR', gloss=None, 
    english='ACID', attributes={'german': 'sauer', 'french': 'acide'}, 
    _list=Conceptlist(
        _api=<pyconcepticon.api.Concepticon object at 0x7f31693be518>, 
        id='Perrin-2010-110', author='Perrin, Loïc-Michel', year=2010, list_suffix='', items=110, 
        tags=['annotated'], source_language=['english', 'french', 'german'], 
        target_language='Global', 
        url='https://journals.dartmouth.edu/cgi-bin/WebObjects/Journals.woa/xmlpage/1/article/353?htmlOnce=yes', 
        refs=['Perrin2010'], pdf=['Perrin2010'], 
        note='This list was used as an initial questionnaire for colexification studies on a world-wide sample of languages.', 
        pages='276f', alias=[], local=False))

Command line interface

Having installed pyconcepticon, you can also directly query concept lists via the terminal command concepticon. To learn about the functionality it provides run

$ concepticon -h
usage: concepticon [-h] [--log-level LOG_LEVEL] [--repos REPOS]
                   [--repos-version REPOS_VERSION]
                   COMMAND ...

optional arguments:
  -h, --help            show this help message and exit
  --log-level LOG_LEVEL
                        log level [ERROR|WARN|INFO|DEBUG] (default: 20)
  --repos REPOS         clone of concepticon/concepticon-data
  --repos-version REPOS_VERSION
                        version of repository data. Requires a git clone!
                        (default: None)

available commands:
  Run "COMAMND -h" to get help for a specific command.

  COMMAND
    attributes          Print all columns in concept lists that contain
                        surplus information.
...

To learn about individual subcommands run concepticon COMMAND -h, e.g.

$ concepticon lookup -h
usage: concepticon lookup [-h]
                          [--format {fancy_grid,fancy_outline,github,grid,html,jira,latex,latex_booktabs,latex_longtable,latex_raw,mediawiki,moinmoin,orgtbl,pipe,plain,presto,pretty,psql,rst,simple,textile,tsv,unsafehtml,youtrack}]
                          [--similarity SIMILARITY] [--full-search]
                          [--language LANGUAGE]
                          GLOSS [GLOSS ...]

Look up the specified glosses in Concepticon.

positional arguments:
  GLOSS

optional arguments:
  -h, --help            show this help message and exit
  --format {fancy_grid,fancy_outline,github,grid,html,jira,latex,latex_booktabs,latex_longtable,latex_raw,mediawiki,moinmoin,orgtbl,pipe,plain,presto,pretty,psql,rst,simple,textile,tsv,unsafehtml,youtrack}
                        Format of tabular output. (default: simple)
  --similarity SIMILARITY
                        specify level of similarity for concept mapping
                        (default: 5)
  --full-search         select between approximate search (default) and full
                        search (default: False)
  --language LANGUAGE   specify your desired language for mapping (default:
                        en)

Configuration

The Python API as well as the CLI can lookup the location of the data from a cldfcatalog config file, under the key concepticon.

Such a config file (and the repository clone) can be created automatically, by installing cldfbench and running cldfbench config.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyconcepticon-4.0.0.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyconcepticon-4.0.0-py3-none-any.whl (1.2 MB view details)

Uploaded Python 3

File details

Details for the file pyconcepticon-4.0.0.tar.gz.

File metadata

  • Download URL: pyconcepticon-4.0.0.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for pyconcepticon-4.0.0.tar.gz
Algorithm Hash digest
SHA256 fc53b17485f82c0624e0b5a746fc95d7348efe3e96697df09e2302f2b0a30616
MD5 e3bf0c5c3bd7c074a4424b7172374c4b
BLAKE2b-256 b8450c432739908b7a058b349d94a3d85c3a6d8c136c5a50726e4189471b3a0a

See more details on using hashes here.

File details

Details for the file pyconcepticon-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyconcepticon-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 1.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for pyconcepticon-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb6d2ab9d78dbfeb454961303b84ce9e2b5bc7475fcd99c4d57a6ab0e9cfdb28
MD5 95f07ab297e929587c7032ca4634c403
BLAKE2b-256 a129cfb5fd79b265007b9e6829f673f83e6289c016b701a4abd76e076f8cf607

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page