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