/sosap

🗣️ sosap(សូរសព្ទ) Python binding for Phonetisaurus

Primary LanguageC++MIT LicenseMIT

Python binding for Phonetisaurus using Cython.

Install

# pypi
pip install sosap

# GitHub
pip install git+https://github.com/seanghay/sosap.git

Phoneticize

from sosap import Model

model = Model("g2p.fst")
model.phoneticize("hello")

Enable Sampling

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']]

License

MIT