Библиотека для анализа и генерации стихов на русском языке
Clone or download
Latest commit 71327f8 Dec 16, 2017

README.md

Python library for analysis and generation of poems in Russian

Current version on PyPI Python versions Build Status Code Climate Documentation Status

Install

sudo pip3 install rupo

or

git clone https://github.com/IlyaGusev/rupo
cd rupo
pip3 install -r requirements.txt
sh download.sh

Usage manual

Analysis

>>> from rupo.api import Engine
>>> engine = Engine(language="ru")
>>> engine.load(<stress model path>, <zalyzniak dict path>)
>>> engine.get_stresses("корова")
[3]

>>> engine.get_word_syllables("корова")
["ко", "ро", "ва"]

>>> engine.is_rhyme("корова", "здорова")
True

>>> text = "Горит восток зарёю новой.\nУж на равнине, по холмам\nГрохочут пушки. Дым багровый\nКругами всходит к небесам."
>>> engine.classify_metre(text)
iambos

Generation

>>> from rupo.api import Engine
>>> engine = Engine(language="ru")
>>> engine.generate_poem(<LSTM model path>, <word form vocabulary path>, <gram_vectors_path>, <stress vocabulary path>, beam_width=<width of beam search>, n_syllables=<number of syllables in each line>)
<poem> or None if could't generate

Models

Литература