Skip to main content

Prereform2modern

Преобразует текст из дореформенной орфографии в современную. Работает в Py3.


  Установка

pip install prereform2modern

  Запуск из командной строки:

 Длинный способ

python -m prereform2modern.translit_from_string "Онъ стоялъ подлѣ письменнаго стола"
Он стоял подле письменного стола

 Короткий способ

translit "Онъ стоялъ подлѣ письменнаго стола"

 Флаг -t отображает изменённые слова в старой орфографии.

translit -t "Онъ стоялъ подлѣ письменнаго стола"
Он{Онъ} стоял{стоялъ} подле{подлѣ} письменного{письменнаго} стола

  Запуск из интерпретатора:

from prereform2modern import Processor
orig_text = "Онъ стоялъ подлѣ письменнаго стола"
text_res, changes, s_json = Processor.process_text(
    text=orig_text,
    show=False,
    delimiters=False,
    check_brackets=False
    )

  Выдача

  • text_res: str

 Преобразованный текст.

print(text_res)
Он стоял подле письменного стола
  • changes: str

 Произведенные изменения.

print(changes)
Онъ --> Он
стоялъ --> стоял
подлѣ --> подле
письменнаго --> письменного
  • str_json: str

 Сведения о всех словах и символах в формате json.

import json
json.loads(s_json)
{'0': {'old_word': 'Онъ', 'type': 'word', 'word': 'Он'},
'1': {'old_word': '', 'type': 'punct', 'word': ' '},
'2': {'old_word': 'стоялъ', 'type': 'word', 'word': 'стоял'},
'3': {'old_word': '', 'type': 'punct', 'word': ' '},
'4': {'old_word': 'подлѣ', 'type': 'word', 'word': 'подле'},
'5': {'old_word': '', 'type': 'punct', 'word': ' '},
'6': {'old_word': 'письменнаго', 'type': 'word', 'word': 'письменного'},
'7': {'old_word': '', 'type': 'punct', 'word': ' '},
'8': {'old_word': '', 'type': 'word', 'word': 'стола'}}

  Параметры

method Processor.process_text(
    text, show, delimiters, check_brackets
    )
  • text: str

 Оригинальный текст в дореформенной орфографии.

  • show: boolean

 Включает в результат заменённые слова в дореформенной орфографии. Если параметр check_brackets=True, то заменённые слова показываются при любом значении параметра show.

  • delimiters: list из трех элементов типа str

 Используется для обозначения заменённых слов. Первый элемент помещается перед новым словом, а другие два элемента выделяют заменённое слово. Так, можно использовать скобки:

delimiters=['', '{', '}']
text="примеръ"
пример{примеръ}

 Или, например, теги XML (про использование тега <choice> см. здесь):

delimiters=['<choice><reg>', '</reg><orig>', '</orig></choice>']
<choice><reg>пример</reg><orig>примеръ</orig></choice>
  • check_brackets: boolean

 Помечает редакторскую правку.

text='Пройдя комнату, такъ [называемую], офиціанскую'
delimiters=['', '{', '}']
check_brackets=True
Пройдя комнату, так{такъ} <choice original_editorial_correction='[называемую]'><sic></sic>
<corr>называемую</corr></choice>, официанскую{офицiанскую}

Metadata

Release files for prereform2modern 1.0.0

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

Source distribution (sdist)

Source distribution for prereform2modern 1.0.0
File Size Uploaded Provenance
prereform2modern-1.0.0.tar.gz 1.0 MB Without provenance Details

Built distribution (wheel)

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

Total release size: 2.0 MB

Release files / prereform2modern-1.0.0.tar.gz

Download URL prereform2modern-1.0.0.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
bfd85936a36630fd936edbd08c1658107457b8465fe10d7eb805c9f3993b4549
BLAKE2b-256 checksum
How to use checksums
88cf01482909618389036c22654d4f34aa5fd8ca48e017a5a89565174fd7d26f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.4

Release files / prereform2modern-1.0.0-py3-none-any.whl

Download URL prereform2modern-1.0.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5bbcec3af88bea1d72978f1b30e4d66b6a28106db29edd4b65c827811c9bbdf7
BLAKE2b-256 checksum
How to use checksums
a33f5a21aa40a86f150094f3415860d72c0c9ab468ddfa80204c1fdb7676019a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.4

Security for prereform2modern 1.0.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

1.0.0 This release

2 release files 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