words2numsrus


Namewords2numsrus JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/mihail8531/Word-to-Number-Russian
SummaryA module which can convert russian numerical words to numbers
upload_time2023-05-05 10:31:45
maintainer
docs_urlNone
authorMax
requires_python>=3.7,<4.0
licenseMIT
keywords numbers convert russian numerical
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Word-to-Number (Russian)

Оригинальный проект: https://github.com/SergeyShk/Word-to-Number-Russian

Проект для перевода чисел, записанных в текстовом виде на русском языке.

## Необходимые библиотеки

* **yargy**;
* **natasha**.

Установка:

`$ pip install words2numsrus`

## Структура проекта

* **number.py** - грамматики для текстового представления чисел;
* **extractor.py** - класс для извлечения чисел;
* **test.py** - модуль тестирования.

## Пример использования

Код:

```python
text = "Выплаты за второго-третьего ребенка выросли на пятьсот двадцать пять тысячных процента и составили 90 тысяч рублей"
extractor = NumberExtractor()

for match in extractor(text):
    print(match.fact)

print(extractor.replace(text))
print(extractor.replace_groups(text))
```

Результат:

```shell
Number(int=2, multiplier=None)
Number(int=3, multiplier=None)
Number(int=500, multiplier=None)
Number(int=20, multiplier=None)
Number(int=5, multiplier=0.001)
Number(int=90, multiplier=1000)
Выплаты за 2-3 ребенка выросли на 500 20 0.005 процента и составили 90000 рублей
Выплаты за 2-3 ребенка выросли на 0.525 процента и составили 90000 рублей
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mihail8531/Word-to-Number-Russian",
    "name": "words2numsrus",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "numbers,convert,russian,numerical",
    "author": "Max",
    "author_email": "max.white.rabbit@gmail.com",
    "download_url": "",
    "platform": null,
    "description": "# Word-to-Number (Russian)\n\n\u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442: https://github.com/SergeyShk/Word-to-Number-Russian\n\n\u041f\u0440\u043e\u0435\u043a\u0442 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0430 \u0447\u0438\u0441\u0435\u043b, \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u043c \u0432\u0438\u0434\u0435 \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435.\n\n## \u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438\n\n* **yargy**;\n* **natasha**.\n\n\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430:\n\n`$ pip install words2numsrus`\n\n## \u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\n\n* **number.py** - \u0433\u0440\u0430\u043c\u043c\u0430\u0442\u0438\u043a\u0438 \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b;\n* **extractor.py** - \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0447\u0438\u0441\u0435\u043b;\n* **test.py** - \u043c\u043e\u0434\u0443\u043b\u044c \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.\n\n## \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f\n\n\u041a\u043e\u0434:\n\n```python\ntext = \"\u0412\u044b\u043f\u043b\u0430\u0442\u044b \u0437\u0430 \u0432\u0442\u043e\u0440\u043e\u0433\u043e-\u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0440\u0435\u0431\u0435\u043d\u043a\u0430 \u0432\u044b\u0440\u043e\u0441\u043b\u0438 \u043d\u0430 \u043f\u044f\u0442\u044c\u0441\u043e\u0442 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u043f\u044f\u0442\u044c \u0442\u044b\u0441\u044f\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 90 \u0442\u044b\u0441\u044f\u0447 \u0440\u0443\u0431\u043b\u0435\u0439\"\nextractor = NumberExtractor()\n\nfor match in extractor(text):\n    print(match.fact)\n\nprint(extractor.replace(text))\nprint(extractor.replace_groups(text))\n```\n\n\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:\n\n```shell\nNumber(int=2, multiplier=None)\nNumber(int=3, multiplier=None)\nNumber(int=500, multiplier=None)\nNumber(int=20, multiplier=None)\nNumber(int=5, multiplier=0.001)\nNumber(int=90, multiplier=1000)\n\u0412\u044b\u043f\u043b\u0430\u0442\u044b \u0437\u0430 2-3 \u0440\u0435\u0431\u0435\u043d\u043a\u0430 \u0432\u044b\u0440\u043e\u0441\u043b\u0438 \u043d\u0430 500 20 0.005 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 90000 \u0440\u0443\u0431\u043b\u0435\u0439\n\u0412\u044b\u043f\u043b\u0430\u0442\u044b \u0437\u0430 2-3 \u0440\u0435\u0431\u0435\u043d\u043a\u0430 \u0432\u044b\u0440\u043e\u0441\u043b\u0438 \u043d\u0430 0.525 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u0430 \u0438 \u0441\u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 90000 \u0440\u0443\u0431\u043b\u0435\u0439\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A module which can convert russian numerical words to numbers",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/mihail8531/Word-to-Number-Russian",
        "Repository": "https://github.com/mihail8531/Word-to-Number-Russian"
    },
    "split_keywords": [
        "numbers",
        "convert",
        "russian",
        "numerical"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a8fc44c5858400d74ab7cc7374bb41ffbb8a27c2e16a1ed06a95bcdefea17ab5",
                "md5": "7668dd717b670a2e255a26a2cc2109d1",
                "sha256": "015da301f72c0f67a1c35765784ec330fd9a0a5a3c7cff3bf12f569442642654"
            },
            "downloads": -1,
            "filename": "words2numsrus-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7668dd717b670a2e255a26a2cc2109d1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 5662,
            "upload_time": "2023-05-05T10:31:45",
            "upload_time_iso_8601": "2023-05-05T10:31:45.029126Z",
            "url": "https://files.pythonhosted.org/packages/a8/fc/44c5858400d74ab7cc7374bb41ffbb8a27c2e16a1ed06a95bcdefea17ab5/words2numsrus-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-05 10:31:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mihail8531",
    "github_project": "Word-to-Number-Russian",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "words2numsrus"
}
        
Max
Elapsed time: 0.14178s