RUAccent
RUAccent — библиотека для автоматической расстановки ударений и буквы «ё» в русском тексте.
Лицензия — MIT.
Установка
pip install ruaccent
Свежая версия из репозитория:
pip install git+https://github.com/Den4ikAI/ruaccent.git
Пример использования
from ruaccent import RUAccent
accentizer = RUAccent()
accentizer.load(omograph_model_size='turbo3.1', use_dictionary=True)
print(accentizer.process_all('на двери висит замок.'))
# на двер+и вис+ит зам+ок.
print(accentizer.process_yo('Все елки зеленые.'))
# Все ёлки зелёные.
Ударение ставится знаком + перед ударной гласной. Остальной текст (пробелы, переносы строк, символы, эмодзи) возвращается без изменений. Слова, в которых ударение уже стоит (пр+ивет), не трогаются.
Параметры
load(omograph_model_size='turbo2', use_dictionary=False, custom_dict=None,
custom_homographs=None, device='CPU', workdir=None, tiny_mode=False)
- omograph_model_size — модель для омографов:
tiny,tiny2,tiny2.1,turbo,turbo2,turbo3,turbo3.1,small_poetry,medium_poetry,big_poetry. - use_dictionary — загрузить полный словарь ударений (требуется больше ОЗУ). Иначе слова, которых нет в малом словаре, размечает нейросеть.
- custom_dict — свои ударения:
{'слово': 'сл+ово'}. - custom_homographs — свои омографы:
{'слово': ['вариант+1', 'вар+иант2']}. - device —
CPU(по умолчанию),CUDA(нуженonnxruntime-gpu),CoreMLдля Apple Silicon илиauto— выбрать лучший доступный. - workdir — папка для моделей. По умолчанию они скачиваются в кэш Hugging Face (
HF_HOME). Для работы без сети после первой загрузки:HF_HUB_OFFLINE=1. - tiny_mode — облегчённый режим: без модели выбора слов для ударения и без полного словаря.
process_all(text, skip_regex=None) и process_yo(text, skip_regex=None) не трогают фрагменты, подходящие под skip_regex (например, r"<[^>]+>" для HTML-тегов).
Для стабильной работы требуется минимум 512 МБ ОЗУ (модель омографов tiny).
Файлы моделей и словарей: huggingface.co/ruaccent/accentuator. Будем признательны за фидбек в Telegram.
Разработка
pip install -e .[test]
pytest # быстрые тесты
RUACCENT_TEST_MODELS=1 pytest # с загрузкой моделей
Донат
Вы можете поддержать проект деньгами. Это поможет быстрее разрабатывать более качественные новые версии. CloudTips: https://pay.cloudtips.ru/p/b9d86686
Metadata
Release files for ruaccent 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ruaccent-1.6.0.tar.gz | 16.0 kB | With provenance | Details for ruaccent-1.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ruaccent-1.6.0-py3-none-any.whl | Python 3 | none | any | Details for ruaccent-1.6.0-py3-none-any.whl |
Total release size: 31.4 kB
Release files / ruaccent-1.6.0.tar.gz
| Download URL | ruaccent-1.6.0.tar.gz |
|---|---|
| Size | 16.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88b1c08ef53827cf3384303d43e259b2570eed412ccd9b5c5e01fc7de0a2b3e1
|
|
BLAKE2b-256 checksum How to use checksums |
3b21d79a23f2762ecacae68ae93e7ea57c11bf9fedbf89b5d2a53dfe58cb069e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / ruaccent-1.6.0-py3-none-any.whl
| Download URL | ruaccent-1.6.0-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6fa90b5dec9edb0a2ed3068fba0f320e31c15c590009e4a86210db1436297cc
|
|
BLAKE2b-256 checksum How to use checksums |
39f0b9479366099e1b06e6f519cf3f21a551f082494c5ff7f99b1124e64ca325
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for ruaccent 1.6.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for ruaccent-1.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA 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.