Skip to main content

A clld plugin adding language family information from Glottolog

Project description

clld-glottologfamily-plugin

clld plugin, adding language families from Glottolog to a clld app to allow for better navigation and visualization.

Build Status PyPI

Usage

To equip a Language model with a family relation, the model should inherit from clld_glottologfamily_plugin.models.HasFamilyMixin. This relation can be populated upon database initialization calling clld_glottologfamily_plugin.util.load_families.

The families assigned in this way have an associated icon which can be used as map marker. To make this easier, a custom IMapMarker may inherit from clld_glottologfamily_plugin.util.LanguageByFamilyMapMarker.

Associated DataTable columns suitable for tables listing Language objects can be used as follows:

from clld.web.datatables.language import Languages
from clld_glottologfamily_plugin.datatables import FamilyCol, MacroareaCol
from clld_glottologfamily_plugin.models import Family

from models import CustomLanguage


class LanguagesWithFamily(Languages):
    def base_query(self, query):
        return query.outerjoin(Family)  # note: isolates will have no related family!

    def col_defs(self):
        res = Languages.col_defs(self)
        res.append(MacroareaCol(self, 'macroarea', language_cls=CustomLanguage))
        res.append(FamilyCol(self, 'family', language_cls=CustomLanguage))
        return res

Assigning families

  1. Family information is retrieved from Glottolog, based on the id attribute of a language. This will only work if id is either a glottocode or an ISO 639-3 code.

  2. If no related family is found, None will be assigned - rather than a dummy isolates family or individual one-member families derived from the language.

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

clld-glottologfamily-plugin-4.1.0.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

clld_glottologfamily_plugin-4.1.0-py2.py3-none-any.whl (12.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file clld-glottologfamily-plugin-4.1.0.tar.gz.

File metadata

File hashes

Hashes for clld-glottologfamily-plugin-4.1.0.tar.gz
Algorithm Hash digest
SHA256 b2971441fbd339d361f8b2c5b15f6bd572ffb10b537831d7ca2081c018665470
MD5 c51bb7c1c47ff8d4137f6d4da03244a8
BLAKE2b-256 3ef17e57c5a5a97b6046baf683ec6fcc7cde468af8b14d09109a9236fd8e0058

See more details on using hashes here.

File details

Details for the file clld_glottologfamily_plugin-4.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for clld_glottologfamily_plugin-4.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 93f8c6444d782a93bd94e7883c7bfe4dbd0ef3d487a386e7174d680f3f1ac39b
MD5 c64f550ef1dcb235f147690478301226
BLAKE2b-256 409b971007093998847aa8faa76c8ba258a2aaef2ec7f0aa5a7715f17afbdd48

See more details on using hashes here.

Supported by

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