Downloads · 30 days
0
omogr/omogre
omogre is a machine learning model from omogr. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as cc-by-nc-sa-4.0.
A library for Python 3. Automatic stress placement and IPA transcription for the Russian language.
Downloads · 30 days
0
Access
Public
Updated May 16, 2025
Repo size
519 MB
Likes
3
Public
Click a slice to open those files.
.gz122 MB · 100%
From the Hugging Face model README
A library for Python 3. Automatic stress placement and IPA transcription for the Russian language.
Installing the library will also install Pytorch and Numpy. Additionally, for model downloading, tqdm and requests will be installed.
pip install git+https://github.com/omogr/omogre.git
Download the code from GitHub. In the directory containing setup.py, run:
pip install -e .
Download the code from GitHub. Install Pytorch, Numpy, tqdm, and requests. Run test.py.
By default, data for models will be downloaded on the first run of the library. The script download_data.py can also be used to download this data.
You can specify a path where the model data should be stored. If data already exists in this directory, it won't be downloaded again.
Script test.py.
from omogre import Accentuator, Transcriptor
# Data will be downloaded to the 'omogre_data' directory
transcriptor = Transcriptor(data_path='omogre_data')
accentuator = Accentuator(data_path='omogre_data')
sentence_list = ['стены замка']
print('transcriptor', transcriptor(sentence_list))
print('accentuator', accentuator(sentence_list))
# Alternative call methods, differing only in notation
print('transcriptor.transcribe', transcriptor.transcribe(sentence_list))
print('accentuator.accentuate', accentuator.accentuate(sentence_list))
print('transcriptor.accentuate', transcriptor.accentuate(sentence_list))
All initialization parameters for the class are optional.
class Transcriptor(data_path: str = None,
download: bool = True,
device_name: str = None,
punct: str = '.,!?')
data_path: Directory where the model should be located.device_name: Parameter defining GPU usage. Corresponds to the initialization parameter of torch.device. Valid values include "cpu", "cuda", "cuda:0", etc. Defaults to "cuda" if GPU is available, otherwise "cpu".punct: List of non-letter characters to be carried over from the source text to the transcription. Default is '.,!?'.download: Whether to download the model from the internet if not found in data_path. Default is True.Class methods:
accentuate(sentence_list: list) -> list
transcribe(sentence_list: list) -> list
accentuate places stresses, transcribe performs transcription. Both inputs take a list of strings and return a list of strings.
The Accentuator class for stress placement is identical to the Transcriptor in terms of stress functionality, except it doesn't load transcription data, reducing initialization time and memory usage.
All initialization parameters are optional, with the same meanings as for Transcriptor.
class Accentuator(data_path: str = None,
download: bool = True,
device_name: str = None)
data_path: Directory where the model should be located.device_name: Parameter for GPU usage. See above for details.download: Whether to download the model if not found. Default is True.Class method:
accentuate(sentence_list: list) -> list
The script ruslan_markup.py places stresses and generates transcriptions for markup files of the acoustic corpora ruslan and natasha.
These markup files already contain manually placed stresses, which were done manually.
The script ruslan_markup.py generates its own stress placement for these files, allowing for an evaluation of the accuracy of stress placement.
Stresses are placed considering context. If very long strings are encountered (for the current model, more than 510 tokens), context won't be considered for these. Stresses in these strings will be placed only where possible without context.
Stresses are also placed in one-syllable words, which might look unusual but simplifies subsequent transcription determination.
During transcription generation, extraneous characters are filtered out. Non-letter characters that are not filtered can be specified by a parameter. By default, four punctuation marks (.,!?) are not filtered. Transcription is determined word by word, without context. The following symbols are used for transcription:
ʲ`ɪətrsɐnjvmapkɨʊleɫdizofʂɕbɡxːuʐæɵʉɛ
Email for questions, comments and suggestions - [email protected].