apertium2ud


Nameapertium2ud JSON
Version 0.0.8 PyPI version JSON
download
home_pagehttps://github.com/alexeyev/apertium2ud
SummaryConverting universal tags to Apertium tags.
upload_time2024-12-23 23:39:06
maintainerNone
docs_urlNone
authorAnton Alekseev
requires_python>=3.7
licenseNone
keywords natural language processing apertium morphology
VCS
bugtrack_url
requirements conllu apertium-streamparser numpy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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.8.

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": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "natural language processing, apertium, morphology",
    "author": "Anton Alekseev",
    "author_email": "anton.m.alexeye@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/41/09/1e7aab6f22f0a03ba73e73b5039650d2ecbad3d27047e3cd7318264b719c/apertium2ud-0.0.8.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.8.\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": null,
    "summary": "Converting universal tags to Apertium tags.",
    "version": "0.0.8",
    "project_urls": {
        "Homepage": "https://github.com/alexeyev/apertium2ud"
    },
    "split_keywords": [
        "natural language processing",
        " apertium",
        " morphology"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0859a35ea22a187e24cbd88e10c25b8377cc4e5ea3f8a82b552590eb7a9a403e",
                "md5": "2c81c3c9e6bdcc14f72791551518754c",
                "sha256": "4f8ceb7ce0ab40c657a0277fc57c4ce9f680056761aeb9f59606d670cb3b2577"
            },
            "downloads": -1,
            "filename": "apertium2ud-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2c81c3c9e6bdcc14f72791551518754c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 23679,
            "upload_time": "2024-12-23T23:39:05",
            "upload_time_iso_8601": "2024-12-23T23:39:05.207806Z",
            "url": "https://files.pythonhosted.org/packages/08/59/a35ea22a187e24cbd88e10c25b8377cc4e5ea3f8a82b552590eb7a9a403e/apertium2ud-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "41091e7aab6f22f0a03ba73e73b5039650d2ecbad3d27047e3cd7318264b719c",
                "md5": "d81d2b353eb2888a6ef1b98d0aa067dc",
                "sha256": "6738d13d6fadaadb64703798ce5db21928902c7ec1ccaa5bb3ff51b58b4324dd"
            },
            "downloads": -1,
            "filename": "apertium2ud-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "d81d2b353eb2888a6ef1b98d0aa067dc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 24236,
            "upload_time": "2024-12-23T23:39:06",
            "upload_time_iso_8601": "2024-12-23T23:39:06.491093Z",
            "url": "https://files.pythonhosted.org/packages/41/09/1e7aab6f22f0a03ba73e73b5039650d2ecbad3d27047e3cd7318264b719c/apertium2ud-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-23 23:39:06",
    "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"
}
        
Elapsed time: 0.46596s