counts syllables in english words. small transformer trained on the cmu pronouncing dictionary, ~95% accuracy.
git clone git@github.com:hipml/syllabify.git
cd syllabify
uv sync
# download data and train (needs a gpu, takes a few minutes)
uv run python data/prepare.py
uv run python train.py
# predict
uv run python predict.py haiku beautiful silencepredict also reads from stdin if you want to pipe things in.
there's an emacs minor mode in emacs/syllabify.el that shows syllable counts at the end of each line. it starts a background server process so the model only loads once.
add to your init.el:
(add-to-list 'load-path "~/path/to/syllabify/emacs")
(require 'syllabify)
(global-syllabify-mode 1)or with use-package:
(use-package syllabify
:load-path "~/path/to/syllabify/emacs"
:config (global-syllabify-mode 1))by default it only activates in markdown-mode. to change that:
(setq syllabify-modes '(markdown-mode text-mode org-mode))you'll need a trained checkpoint at checkpoints/best.pt before the server will start.