rhasspy / gruut-ipa

Python library for manipulating pronunciations using the International Phonetic Alphabet (IPA)
MIT License
78 stars 12 forks source link

python interpreter #5

Open martino-vic opened 3 years ago

martino-vic commented 3 years ago

Hello, I'm trying to use gruut-ipa 0.10.0 on Windows 10 and Python 3.9. I need to group phones into phonemes for English:

$ python3 -m gruut_ipa phonemes en-us "/dʒʌst ə kaʊ/"
d͡ʒ ʌ s t ə k aʊ

How would this look in the python interpreter? I've tried

>>> import gruut_ipa
>>> help(gruut_ipa.Phonemes)

But I couldn't find an answer there.

valericus commented 2 years ago

This approach works for me.

>>> from gruut_ipa import Pronunciation
>>> Pronunciation.from_string('/dʒʌst ə kaʊ/').phones
[d, ʒ, ʌ, s, t, ə, k, a, ʊ]

It should be noted, that phones property contains not list of strings, but list of gruut_ipa.Phone instances.