Skip to content

hipml/syllabify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

syllabify

counts syllables in english words. small transformer trained on the cmu pronouncing dictionary, ~95% accuracy.

setup

git clone git@github.com:hipml/syllabify.git
cd syllabify
uv sync

usage

# 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 silence

predict also reads from stdin if you want to pipe things in.

emacs

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.

About

a 5M parameter solution to a problem you could solve by counting on your fingers

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors