Skip to main content

Word-to-Number (Russian)

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

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

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

  • yargy;
  • natasha.

Установка:

$ pip install words2numsrus

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

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

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

Код:

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

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

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

Результат:

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 рублей

Metadata

Release files for words2numsrus 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for words2numsrus 0.1.0
File Interpreter ABI Platform Actions
words2numsrus-0.1.0-py3-none-any.whl Python 3 none any Details for words2numsrus-0.1.0-py3-none-any.whl

Release files / words2numsrus-0.1.0-py3-none-any.whl

Download URL words2numsrus-0.1.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
015da301f72c0f67a1c35765784ec330fd9a0a5a3c7cff3bf12f569442642654
BLAKE2b-256 checksum
How to use checksums
a8fc44c5858400d74ab7cc7374bb41ffbb8a27c2e16a1ed06a95bcdefea17ab5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.10.10 Linux/6.2.9-arch1-1

Security for words2numsrus 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page