Skip to content
/ rupo Public
forked from IlyaGusev/rupo

Библиотека для анализа и генерации стихов на русском языке

License

Notifications You must be signed in to change notification settings

zachanton/rupo

 
 

Repository files navigation

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

Литература

About

Библиотека для анализа и генерации стихов на русском языке

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.9%
  • Shell 0.1%