Python binding for Phonetisaurus using Cython.
# pypi
pip install sosap
# GitHub
pip install git+https://github.com/seanghay/sosap.git
from sosap import Model
model = Model("g2p.fst")
model.phoneticize("hello")
from sosap import Model
model = Model("g2p.fst")
results = model.phoneticize_sampling("hello", nbest=4)
# => [['h', 'ΙΙ', 'l', 'oo'], ['h', 'ee', '.', 'l', 'oo'], ['h', 'ΙΙ', 'l', '.', 'l', 'ΙΙ'], ['h', 'ΙΙ', '.', 'l', 'oo']]
results = model.phoneticize_sampling("hello", nbest=4, beam=1000, threshold=99.0, pmass=99.0)
# => [['h', 'ΙΙ', 'l', 'oo'], ['h', 'ee', '.', 'l', 'oo'], ['h', 'ΙΙ', 'l', '.', 'l', 'ΙΙ'], ['h', 'ΙΙ', '.', 'l', 'oo']]
MIT