Skip to main content

Pure-Python port of eyo-kernel (dictionary-based yoification)

Project description

peyo

Pure-Python port of eyo-kernel (dictionary-based Russian “ё” restoration / yoification).
No Node.js required.

🇷🇺 Русская документация: README.ru.md

Install

pip install peyo

Quickstart

import peyo

text = "«Лед тронулся, господа присяжные заседатели!»"
print(peyo.yoify(text))
# -> «Лёд тронулся, господа присяжные заседатели!»

Modes

Yoification in Russian is ambiguous (e.g. все/всё, осел/осёл).
So peyo supports two modes:

  • mode="safe" (default): conservative replacements, minimal false positives
  • mode="not_safe": more aggressive, can produce mistakes
import peyo

print(peyo.yoify("Ежик и елка"))
# -> "Ёжик и ёлка"

print(peyo.yoify("все", mode="safe"))
# -> "все"     (safe avoids ambiguous cases)

print(peyo.yoify("все", mode="not_safe"))
# -> "всё"     (more aggressive)

API

peyo.yoify(text: str, mode: str = "safe") -> str

Main function. Stable public API.

Aliases:

  • peyo.restore(...)
  • peyo.yo(...)

peyo.lint(text: str, mode: str = "safe", group_by_words: bool = False) -> list[dict]

Returns a list of suggested replacements (does not modify the text).

Example output item:

{
  "before": "Лед",
  "after": "Лёд",
  "position": [{"line": 1, "column": 2, "index": 1}]
}

Notes

  • This library is dictionary-based (no ML, no true contextual disambiguation).
  • safe mode is recommended for fully automatic pipelines.
  • For maximum quality you typically use safe restore + manual review of not_safe candidates.

Attribution / License

This project is a Python port of eyo-kernel by Denis Seleznev and uses upstream dictionaries.
The upstream project is MIT-licensed. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

peyo-0.2.0.tar.gz (108.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

peyo-0.2.0-py3-none-any.whl (108.8 kB view details)

Uploaded Python 3

File details

Details for the file peyo-0.2.0.tar.gz.

File metadata

  • Download URL: peyo-0.2.0.tar.gz
  • Upload date:
  • Size: 108.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for peyo-0.2.0.tar.gz
Algorithm Hash digest
SHA256 029cdd3bc037fa65dd76d355264799a2789def5cde71193d733d4cebad34fcc7
MD5 ed07f06849310c3f62a8dbaa890f1f4a
BLAKE2b-256 bb7806b89838a1dd4e6caa9f367594b0bc9e0f1697255762a5d2a1e31364fcbb

See more details on using hashes here.

File details

Details for the file peyo-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: peyo-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 108.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for peyo-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 851a1cd75263756e0fea790311d128b16f5197e7f7cb76107bdd899689f87fea
MD5 b4853e6c051d9a9513d9ac434ac1afdb
BLAKE2b-256 e88d58ba24e2efc9d5a39a30463934ff2b33ee43433fcd4e142407dd229f9eef

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page