Skip to main content

Build Status Coverage

Toponym

Build grammatical cases for words in Slavic languages from pre-defined recipes.

documentation: https://toponym.iwpnd.pw/

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Installing

for usage:

pip install toponym

for development:

git clone https://github.com/iwpnd/toponym.git
pip install flit
flit install toponym --symlink

Description

Problem

In Slavic languages a word can change, depending on how and where it is used within a sentence. The city Moscow (Москва) changes to Москве when used prepositional. So when you want to eg. know if:

"Москва" in "В Москве с начала года отремонтировали 3 тысячи подъездов"

>> False

Solution

This is where Toponym comes in. Utilizing pre-defined recipes it naively creates grammatical cases depending on the ending of the input word that the user wants to create Toponyms from. The recipe looks as follows:

Recipe

recipe = {
    "а": { # ending of the input-word
        "nominative": [[""], 0],
        "genitive": [ # case that we need
            ["ы","и"], # ending of the output-word
            1 # chars to be deleted, before ending of output is added
            ],
        "dative": [["е"], 1],
        "accusative": [["у"], 1],
        "instrumental": [...]
}

If multiple endings are given, multiple toponyms with that ending will be created. Some of those created toponyms do not make sense, or are not used in the wild. If you have an idea about how to remove those that are unreal please contact me.

With the built toponyms for you can now check:

from toponym.recipes import Recipes
from toponym.toponym import Toponym

recipes_russian = Recipes()
recipes_russian.load_from_language(language='russian')

city = "Москва"

t = Toponym(input_word=city, recipes=recipes_russian)
t.build()

print(t.list_toponyms())
>> ['Москвой', 'Москвы', 'Москви', 'Москве', 'Москву', 'Москва']

any([word in "В Москве с начала года отремонтировали 3 тысячи подъездов" for word in tn.list_toponyms()])
>> True

supported languages:

full name		iso code
croatian		hr
russian		    ru
ukrainian		uk
romanian		ro
latvian		    lv
hungarian		hu
greek		    el
polish		    pl

Running the tests

pytest toponym/tests/

Metadata

Release files for toponym 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for toponym 0.5.1
File Size Uploaded Provenance
toponym-0.5.1.tar.gz 23.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for toponym 0.5.1
File Interpreter ABI Platform
toponym-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 45.0 kB

Release files / toponym-0.5.1.tar.gz

Download URL toponym-0.5.1.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cb2bb6e18b6c4c7621b37d109632dfd67523a916b87b9dbe6d83762dc9870d20
BLAKE2b-256 checksum
How to use checksums
a07f1a93e7de33a296c3d079003f95ad0545b98286c6fae564f3789ae4929f3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.23.0

Release files / toponym-0.5.1-py3-none-any.whl

Download URL toponym-0.5.1-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
880cd2de807d976c38e5be7811a92020f7bca5aed053c6aa244fb0e506c18e16
BLAKE2b-256 checksum
How to use checksums
faedc25407d77f461ad1e59ca0d18f83e2e4bada2f33fe47b0195603772a8afd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.23.0

Security for toponym 0.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page