Skip to main content
PyCon US is happening May 14th-22nd in Pittsburgh, PA USA.  Learn more

Work with ISO 639-1, ISO 639-2B, ISO 639-2T, and ISO 639-3 language data.

Project description

commondata-languages

Work with ISO 639-1, ISO 639-2B, ISO 639-2T, and ISO 639-3 language data.

List, lookup with fuzzy search.

Installation

pip install commondata-languages

Usage

Iterate over all languages:

from commondata_languages import LanguageData

languages = LanguageData()

for language in languages:
    print(language.name)

List all languages:

from commondata_languages import LanguageData

languages = LanguageData()

print(languages.all())

Lookup a language

from commondata_languages import LanguageData

languages = LanguageData()

# Lookup by name (case insensitive, fuzzy search)
language = languages["Hindi"]

# Lookup by ISO 639-1
language = languages["en"]

# Lookup by ISO 639-3
language = languages["eng"]

# Lookup by ISO 639-2B
language = languages["chi"]

# Lookup by ISO 639-2T
language = languages["zho"]

# Look up with fuzzy search
language = languages["Englih"]

print(language)
> Language(name='English', iso1='en', iso2b='eng', iso2t='eng', iso3='eng', scope='Individual', type='Living')

Use CLI to lookup a language

python -m commondata-languages English

Load languages data into pandas dataframe

import pandas as pd

from commondata_languages.data import languages

df = pd.DataFrame(languages)

Other Formats and Datasets

Download CSV, XLSX, JSON and YAML files from commondata.net/library.

commondata.net maintains a collection of essential datasets in a variety of formats, including python bindings. Check out the full library here: commondata.net/library.

Contributing

Contributions are welcome! Please open an issue or submit a pull request here.

License

This project is licensed under GPLv3. See the LICENSE file for details.

Support

For feedback, feature requests, or support, please email support@commondata.net.

Supported by

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