# apertium2ud
Obtaining the mapping between the two tagsets based
on the [information from Apertium Wiki](https://wiki.apertium.org/w/index.php?title=List_of_symbols).
Loosely based on [this code](https://github.com/mr-martian/apertium-recursive-learning/blob/master/tags.py),
hence the GPLv3 license.
To install, run
```bash
python -m pip install apertium2ud
```
The latest uploaded version is 0.0.4.
NB! The latest version from PyPI (yes, you can install the tool via pip) is equipped with the [apertium-kir](https://github.com/apertium/apertium-kir/blob/main/apertium-kir.kir.udx) `.udx` file rules.
To build the machine-readable mapping, run
```bash
python apertium_wiki_parser.py
```
## Apertium to Universal tags
```
>>> from apertium2ud.convert import a2ud
>>> tags = ["n", "pl", "acc"]
>>> a2ud(tags)
(['NOUN'], ['Number=Plur', 'Case=Acc'])
>>> tags_sophisticated = ["v", "tv", "ger", "nom", "cop", "aor", "p3", "pl"]
>>> a2ud(tags_sophisticated)
(['VERB', 'AUX'], ['Subcat=Tran', 'VerbForm=Vnoun', 'Case=Nom', 'Tense=Past', 'Person=3', 'Number=Plur'])
```
## Universal tags to Apertium
So far the conversion is far from perfect
```
Кыз NOUN {'Number[psor]=Sing', 'Number=Sing', 'Case=Nom', 'Person[psor]=3', 'Person=3'} ->
<px3sg><n><subj?nom?><sg><p3><px3sp>
досуна NOUN {'Number[psor]=Sing', 'Number=Sing', 'Person[psor]=3', 'Case=Dat', 'Person=3'} ->
<px3sg><n><sg><dat><p3><px3sp>
кат NOUN {'Case=Nom', 'Person=3', 'Number=Sing'} ->
<n><subj?nom?><sg><p3>
жазган VERB {'Aspect=Perf', 'Polarity=Pos', 'Number=Sing', 'Tense=Past', 'Person=3', 'Evident=Fh'} ->
<past3p><vblex?v?vbmod?><sg><aff><aor?past?pret?><perf><p3>
. PUNCT set() ->
<sent?apos?percent?clb?punct?>
```
## TODO
* Should sections `chunks` and [XML tags](https://wiki.apertium.org/w/index.php?title=List_of_symbols#XML_tags) be added? [No](https://github.com/apertium/apertium/issues/185).
* Tests: Apertium -> UD -> Apertium, UD -> Apertium -> UD (sometimes losses are inevitable)
* Add the possibility to add the rules based on a `.udx` file, which usually describes custom tags
## How to cite
Greatly appreciated, if you use this work.
```
@misc{apertium2ud2023alekseev,
title = {{alexeyev/apertium2ud: mapping tagsets}},
year = {2023},
url = {https://github.com/alexeyev/apertium2ud}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/alexeyev/apertium2ud",
"name": "apertium2ud",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "natural language processing,apertium,morphology",
"author": "Anton Alekseev",
"author_email": "anton.m.alexeye@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/72/75/1b97a636d2bb1eece963ba8dd40ccaadd2269ee116b80cbbc66543bc12e7/apertium2ud-0.0.7.tar.gz",
"platform": null,
"description": "# apertium2ud\n\nObtaining the mapping between the two tagsets based \non the [information from Apertium Wiki](https://wiki.apertium.org/w/index.php?title=List_of_symbols).\n\nLoosely based on [this code](https://github.com/mr-martian/apertium-recursive-learning/blob/master/tags.py), \nhence the GPLv3 license.\n\nTo install, run\n\n```bash\npython -m pip install apertium2ud\n```\nThe latest uploaded version is 0.0.4.\n\nNB! The latest version from PyPI (yes, you can install the tool via pip) is equipped with the [apertium-kir](https://github.com/apertium/apertium-kir/blob/main/apertium-kir.kir.udx) `.udx` file rules.\n\nTo build the machine-readable mapping, run\n\n```bash\npython apertium_wiki_parser.py\n```\n## Apertium to Universal tags\n\n```\n>>> from apertium2ud.convert import a2ud\n>>> tags = [\"n\", \"pl\", \"acc\"]\n>>> a2ud(tags)\n(['NOUN'], ['Number=Plur', 'Case=Acc'])\n>>> tags_sophisticated = [\"v\", \"tv\", \"ger\", \"nom\", \"cop\", \"aor\", \"p3\", \"pl\"]\n>>> a2ud(tags_sophisticated)\n(['VERB', 'AUX'], ['Subcat=Tran', 'VerbForm=Vnoun', 'Case=Nom', 'Tense=Past', 'Person=3', 'Number=Plur'])\n```\n\n## Universal tags to Apertium\n\nSo far the conversion is far from perfect\n```\n\u041a\u044b\u0437 NOUN {'Number[psor]=Sing', 'Number=Sing', 'Case=Nom', 'Person[psor]=3', 'Person=3'} ->\n<px3sg><n><subj?nom?><sg><p3><px3sp> \n\n\u0434\u043e\u0441\u0443\u043d\u0430 NOUN {'Number[psor]=Sing', 'Number=Sing', 'Person[psor]=3', 'Case=Dat', 'Person=3'} ->\n<px3sg><n><sg><dat><p3><px3sp> \n\n\u043a\u0430\u0442 NOUN {'Case=Nom', 'Person=3', 'Number=Sing'} ->\n<n><subj?nom?><sg><p3> \n\n\u0436\u0430\u0437\u0433\u0430\u043d VERB {'Aspect=Perf', 'Polarity=Pos', 'Number=Sing', 'Tense=Past', 'Person=3', 'Evident=Fh'} ->\n<past3p><vblex?v?vbmod?><sg><aff><aor?past?pret?><perf><p3> \n\n. PUNCT set() ->\n<sent?apos?percent?clb?punct?> \n```\n\n## TODO\n\n* Should sections `chunks` and [XML tags](https://wiki.apertium.org/w/index.php?title=List_of_symbols#XML_tags) be added? [No](https://github.com/apertium/apertium/issues/185).\n* Tests: Apertium -> UD -> Apertium, UD -> Apertium -> UD (sometimes losses are inevitable)\n* Add the possibility to add the rules based on a `.udx` file, which usually describes custom tags\n\n## How to cite\n\nGreatly appreciated, if you use this work.\n\n```\n@misc{apertium2ud2023alekseev,\n title = {{alexeyev/apertium2ud: mapping tagsets}},\n year = {2023},\n url = {https://github.com/alexeyev/apertium2ud}\n}\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Converting universal tags to Apertium tags.",
"version": "0.0.7",
"project_urls": {
"Homepage": "https://github.com/alexeyev/apertium2ud"
},
"split_keywords": [
"natural language processing",
"apertium",
"morphology"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a8bcfa7abe4fea29e4e17b29e0dba2e41b383ca7c62b0879c893611dcb56abef",
"md5": "7d07df9a6d9689de208664b35d96c98b",
"sha256": "3d5d6d9a41d3a685caa1bf692e8d3362e6f2f8d0ca751fec7c551b51b310d6be"
},
"downloads": -1,
"filename": "apertium2ud-0.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7d07df9a6d9689de208664b35d96c98b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 23699,
"upload_time": "2023-06-19T11:52:37",
"upload_time_iso_8601": "2023-06-19T11:52:37.959594Z",
"url": "https://files.pythonhosted.org/packages/a8/bc/fa7abe4fea29e4e17b29e0dba2e41b383ca7c62b0879c893611dcb56abef/apertium2ud-0.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "72751b97a636d2bb1eece963ba8dd40ccaadd2269ee116b80cbbc66543bc12e7",
"md5": "38e7acd12a008dbc8586d49db0e35e4d",
"sha256": "0a0aae24b3311324d6fadb16d9094a32959183e28f5c425003ce9ffe0d874a5f"
},
"downloads": -1,
"filename": "apertium2ud-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "38e7acd12a008dbc8586d49db0e35e4d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 24201,
"upload_time": "2023-06-19T11:52:40",
"upload_time_iso_8601": "2023-06-19T11:52:40.054073Z",
"url": "https://files.pythonhosted.org/packages/72/75/1b97a636d2bb1eece963ba8dd40ccaadd2269ee116b80cbbc66543bc12e7/apertium2ud-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-19 11:52:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alexeyev",
"github_project": "apertium2ud",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "conllu",
"specs": [
[
">=",
"4.5.2"
]
]
},
{
"name": "apertium-streamparser",
"specs": [
[
">=",
"5.0.2"
]
]
},
{
"name": "numpy",
"specs": [
[
">=",
"1.24.3"
]
]
}
],
"lcname": "apertium2ud"
}