{"id":15887915,"url":"https://github.com/iwpnd/toponym","last_synced_at":"2025-04-02T16:43:22.936Z","repository":{"id":62584918,"uuid":"189424453","full_name":"iwpnd/toponym","owner":"iwpnd","description":"build grammatical cases for words in slavic languages","archived":false,"fork":false,"pushed_at":"2020-04-30T09:20:44.000Z","size":148,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T13:04:32.506Z","etag":null,"topics":["grammar-parser","grammatical-cases","nlp","python","slavic-grammar","slavic-languages","toponym"],"latest_commit_sha":null,"homepage":"https://toponym.iwpnd.pw/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iwpnd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-30T14:04:14.000Z","updated_at":"2020-09-12T20:26:27.000Z","dependencies_parsed_at":"2022-11-03T21:52:23.785Z","dependency_job_id":null,"html_url":"https://github.com/iwpnd/toponym","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Ftoponym","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Ftoponym/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Ftoponym/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwpnd%2Ftoponym/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iwpnd","download_url":"https://codeload.github.com/iwpnd/toponym/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246852991,"owners_count":20844503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grammar-parser","grammatical-cases","nlp","python","slavic-grammar","slavic-languages","toponym"],"created_at":"2024-10-06T06:05:41.251Z","updated_at":"2025-04-02T16:43:22.917Z","avatar_url":"https://github.com/iwpnd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003ca href=\"https://github.com/iwpnd/toponym/actions\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://github.com/iwpnd/toponym/workflows/build/badge.svg?branch=master\" alt=\"Build Status\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/iwpnd/toponym\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/iwpnd/toponym/branch/master/graph/badge.svg\" alt=\"Coverage\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\n# Toponym\n\nBuild grammatical cases for words in Slavic languages from pre-defined recipes.\n\n**documentation**: [https://toponym.iwpnd.pw/](https://toponym.iwpnd.pw/)  \n\n## Getting Started\n\nThese instructions will get you a copy of the project up and running on your local machine for development and testing purposes.\n\n### Installing\n\nfor usage:\n```\npip install toponym\n```\n\nfor development:\n```\ngit clone https://github.com/iwpnd/toponym.git\npip install flit\nflit install toponym --symlink\n```\n\n# Description\n\n## Problem\nIn 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.\nSo when you want to eg. know if:\n\n```python\n\"Москва\" in \"В Москве с начала года отремонтировали 3 тысячи подъездов\"\n\n\u003e\u003e False\n```\n\n## Solution\nThis 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:\n\n### Recipe\n```python\nrecipe = {\n    \"а\": { # ending of the input-word\n        \"nominative\": [[\"\"], 0],\n        \"genitive\": [ # case that we need\n            [\"ы\",\"и\"], # ending of the output-word\n            1 # chars to be deleted, before ending of output is added\n            ],\n        \"dative\": [[\"е\"], 1],\n        \"accusative\": [[\"у\"], 1],\n        \"instrumental\": [...]\n}\n```\n\nIf 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.\n\nWith the built toponyms for you can now check:\n\n```python\nfrom toponym.recipes import Recipes\nfrom toponym.toponym import Toponym\n\nrecipes_russian = Recipes()\nrecipes_russian.load_from_language(language='russian')\n\ncity = \"Москва\"\n\nt = Toponym(input_word=city, recipes=recipes_russian)\nt.build()\n\nprint(t.list_toponyms())\n\u003e\u003e ['Москвой', 'Москвы', 'Москви', 'Москве', 'Москву', 'Москва']\n\nany([word in \"В Москве с начала года отремонтировали 3 тысячи подъездов\" for word in tn.list_toponyms()])\n\u003e\u003e True\n```\n\n\n### supported languages:\n\n```\nfull name\t\tiso code\ncroatian\t\thr\nrussian\t\t    ru\nukrainian\t\tuk\nromanian\t\tro\nlatvian\t\t    lv\nhungarian\t\thu\ngreek\t\t    el\npolish\t\t    pl\n```\n\n## Running the tests\n\n```\npytest toponym/tests/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwpnd%2Ftoponym","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiwpnd%2Ftoponym","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwpnd%2Ftoponym/lists"}