Script to prep blocks of English tex for conversion into .gabc files
This script was created to make creation of .gabc files for the use by The Gregorio Project as simple as possible. For Gregorio to work, each syllable of the word needs to be pointed with the proper neum. However, manually splitting words into syllables is tedious in the extreme, so this script was created to take out much of that work.
It uses the hyphenate python library to implement an algorithm devised by Frank Liang to hyphenate words for TeX ages ago. It is not a perfect algorithm, but it gets close enough for government work.
$ echo "some text to split on syllables" | python gabc_prep.py
some() text() to() split() on() syl()la()bles()
$ echo "some text to split on syllables
across multiple lines" | python .\gabc_prep.py
some() text() to() split() on() syl()la()bles()
across() mul()ti()ple() lines()
First, you will need to install the module:
pip install -e /path/to/repo
Then, it can be used in the following manner:
from gabc_prep import prep_text
print(prep_text(text_to_prep="some text to prepare"))