fitrat


Namefitrat JSON
Version 0.0.9 PyPI version JSON
download
home_page
SummaryAn NLP library for Uzbek. It includes morphological analysis, language identification, transliterators and tokenizers.
upload_time2023-01-26 18:45:28
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) Tahrirchi Authors: Mukhammadsaid Mamasaidov, Jasur Yusupov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords language morphology nlp tahrirchi transliteration uzbek
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # fitrat

<img src="https://github.com/tahrirchi/fitrat/blob/main/fitrat.png" alt="Abdurauf Fitrat" style="width:125px;" align="left"/>

An NLP library for Uzbek. It includes morphological analysis, transliterators, language identifiers, tokenizers and many more.

It is named after historian and linguist Abdurauf Fitrat, who was one of the creators of Modern Uzbek as well as the first Uzbek professor.

<br />

## Usage

### Installation

```shell
pip install fitrat
```

### Transliteration

We used `hfst` library for creating transliterators. This library provides finite-state transducers, a finite-state machines that come very handy for efficient mapping one text to another.

```python
from fitrat import Transliterator, WritingType

t = Transliterator(to=WritingType.LAT)
result = t.convert("Кеча циркка бордим.")
print(result)
# Kecha sirkka bordim.

t2 = Transliterator(to=WritingType.CYR)
result = t2.convert("Kecha sirkka bordim.")
print(result)
# Кеча циркка бордим.
```

While Cyrillic-Latin conversion is rule-based and simple, the converse is not true. We included special pre-compiled exceptions transducer for Latin-Cyrillic that handles all (to our knowledge) exceptions. We'll continue working on improving on our exceptions list.

If you want to compile the transliterators from source, you have to use `hfst-dev` or `hfst` library. The package uses only pre-compiled binaries and `hfstol` library for efficient lookup.

### Language Identification

We can recognize Uzbek text, both Latin or Cyrillic. Additionally, we can recognize other major languages, such as Russian, English, Arabic and etc.

```python
from fitrat import LanguageDetector

lang_detector = LanguageDetector()

print(lang_detector.is_uzbek("bu o'zbekchada yozilgan matn"))
# True

print(lang_detector.is_uzbek("бу нотугри йозилган булсаям, лекин узбекча матн"))
# True

print(lang_detector.is_uzbek("Текст на русском языке"))
# False
```

## Tokenization

```python
from fitrat import word_tokenize

s = "Bugun o'zbekchada gapirishga qaror qildim!"
print(word_tokenize(s))
# ['Bugun', "o'zbekchada", 'gapirishga', 'qaror', 'qildim', '!']
```

## Authors

- Mukhammadsaid Mamasaidov
- Jasur Yusupov

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "fitrat",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Muhammadsaid Mamasaidov <mukhammadsaid.mamasaidov@gmail.com>, Jasur Yusupov <jasuryusupov14@gmail.com>",
    "keywords": "language,morphology,nlp,tahrirchi,transliteration,uzbek",
    "author": "",
    "author_email": "Muhammadsaid Mamasaidov <mukhammadsaid.mamasaidov@gmail.com>, Jasur Yusupov <jasuryusupov14@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/15/a8/bd57eb9098fbef77fa377e421bb314041f1b8ea2e5a6733d2b0f24562441/fitrat-0.0.9.tar.gz",
    "platform": null,
    "description": "# fitrat\n\n<img src=\"https://github.com/tahrirchi/fitrat/blob/main/fitrat.png\" alt=\"Abdurauf Fitrat\" style=\"width:125px;\" align=\"left\"/>\n\nAn NLP library for Uzbek. It includes morphological analysis, transliterators, language identifiers, tokenizers and many more.\n\nIt is named after historian and linguist Abdurauf Fitrat, who was one of the creators of Modern Uzbek as well as the first Uzbek professor.\n\n<br />\n\n## Usage\n\n### Installation\n\n```shell\npip install fitrat\n```\n\n### Transliteration\n\nWe used `hfst` library for creating transliterators. This library provides finite-state transducers, a finite-state machines that come very handy for efficient mapping one text to another.\n\n```python\nfrom fitrat import Transliterator, WritingType\n\nt = Transliterator(to=WritingType.LAT)\nresult = t.convert(\"\u041a\u0435\u0447\u0430 \u0446\u0438\u0440\u043a\u043a\u0430 \u0431\u043e\u0440\u0434\u0438\u043c.\")\nprint(result)\n# Kecha sirkka bordim.\n\nt2 = Transliterator(to=WritingType.CYR)\nresult = t2.convert(\"Kecha sirkka bordim.\")\nprint(result)\n# \u041a\u0435\u0447\u0430 \u0446\u0438\u0440\u043a\u043a\u0430 \u0431\u043e\u0440\u0434\u0438\u043c.\n```\n\nWhile Cyrillic-Latin conversion is rule-based and simple, the converse is not true. We included special pre-compiled exceptions transducer for Latin-Cyrillic that handles all (to our knowledge) exceptions. We'll continue working on improving on our exceptions list.\n\nIf you want to compile the transliterators from source, you have to use `hfst-dev` or `hfst` library. The package uses only pre-compiled binaries and `hfstol` library for efficient lookup.\n\n### Language Identification\n\nWe can recognize Uzbek text, both Latin or Cyrillic. Additionally, we can recognize other major languages, such as Russian, English, Arabic and etc.\n\n```python\nfrom fitrat import LanguageDetector\n\nlang_detector = LanguageDetector()\n\nprint(lang_detector.is_uzbek(\"bu o'zbekchada yozilgan matn\"))\n# True\n\nprint(lang_detector.is_uzbek(\"\u0431\u0443 \u043d\u043e\u0442\u0443\u0433\u0440\u0438 \u0439\u043e\u0437\u0438\u043b\u0433\u0430\u043d \u0431\u0443\u043b\u0441\u0430\u044f\u043c, \u043b\u0435\u043a\u0438\u043d \u0443\u0437\u0431\u0435\u043a\u0447\u0430 \u043c\u0430\u0442\u043d\"))\n# True\n\nprint(lang_detector.is_uzbek(\"\u0422\u0435\u043a\u0441\u0442 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435\"))\n# False\n```\n\n## Tokenization\n\n```python\nfrom fitrat import word_tokenize\n\ns = \"Bugun o'zbekchada gapirishga qaror qildim!\"\nprint(word_tokenize(s))\n# ['Bugun', \"o'zbekchada\", 'gapirishga', 'qaror', 'qildim', '!']\n```\n\n## Authors\n\n- Mukhammadsaid Mamasaidov\n- Jasur Yusupov\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) Tahrirchi  Authors: Mukhammadsaid Mamasaidov, Jasur Yusupov  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "An NLP library for Uzbek. It includes morphological analysis, language identification, transliterators and tokenizers.",
    "version": "0.0.9",
    "split_keywords": [
        "language",
        "morphology",
        "nlp",
        "tahrirchi",
        "transliteration",
        "uzbek"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a8f422eb8e9e7bcc846655754ce20965ee6d93af85e693c8814d7747a5e2d55f",
                "md5": "6702612730cb858c160172bb33da91aa",
                "sha256": "fdfbaaf627420bb1a66d0061ebcf8589d7b378ca5e32e3e146bdb4d1bf5511a8"
            },
            "downloads": -1,
            "filename": "fitrat-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6702612730cb858c160172bb33da91aa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 15773767,
            "upload_time": "2023-01-26T18:44:56",
            "upload_time_iso_8601": "2023-01-26T18:44:56.784011Z",
            "url": "https://files.pythonhosted.org/packages/a8/f4/22eb8e9e7bcc846655754ce20965ee6d93af85e693c8814d7747a5e2d55f/fitrat-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "15a8bd57eb9098fbef77fa377e421bb314041f1b8ea2e5a6733d2b0f24562441",
                "md5": "acdb0e6eb5e9055d57b4769fbde3d09f",
                "sha256": "cce818d4247bb29bd9c279833c66c4e736458808fcc551e4775ea1cbdbedd45e"
            },
            "downloads": -1,
            "filename": "fitrat-0.0.9.tar.gz",
            "has_sig": false,
            "md5_digest": "acdb0e6eb5e9055d57b4769fbde3d09f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16309816,
            "upload_time": "2023-01-26T18:45:28",
            "upload_time_iso_8601": "2023-01-26T18:45:28.651738Z",
            "url": "https://files.pythonhosted.org/packages/15/a8/bd57eb9098fbef77fa377e421bb314041f1b8ea2e5a6733d2b0f24562441/fitrat-0.0.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-26 18:45:28",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "fitrat"
}
        
Elapsed time: 0.60045s