Package: gruut-ipa
Gruut IPALibrary for manipulatingInternational Phonetic Alphabet(IPA) pronunciations.Features include:Getting the category and details of a phone, e.g. "open front unrounded vowel" for ɶSplitting IPA pronunciations into groups of:Phones (/ˈt͡ʃuːz/toˈt͡ʃ uː z)Phonemes (/kˈaʊ/tok ˈaʊfor U.S. English)Converting pronunciations between:IPAespeaksampaSupported Languages:Arabic (ar)Czech (cs-cz)German (de-de)U.S. English (en-us)U.K. English (en-gb)Spanish (es-es)Persian/Farsi (fa)Spanish (es-es)Italian (it-it)Luxembourgish (lb-lb)Dutch (nl)Portuguese (pt)Russian (ru-ru)Swahili (sw)Installing$pipinstallgruut-ipaDependenciesPython 3.6 or higherFor command-line usage, you may also want:espeakjqInstall these with:$sudoapt-getinstallespeakjqPhones and PhonemesPhones in IPA are composed of different components:LettersNon-combiningUnicode characters that represent a distinct human sound (phone)SuprasegmentalsNon-combiningUnicode characters that represent language features above individual vowels or consonantsStress (ˈˌ), elongation (ː), linking/ties (t͡s), and short/long breaks (| ‖) are suprasegmentalsDiacriticsCombining charactersthat provide additional information about a phone's pronunciation, such asnasalationSeeIPA Chartfor more details.PhonemesWhile phones represent individual sounds, phonemes are the phonetic units of a language that meaningfully distinguish words. A phoneme may be realized by many different phones. For example, the/r/inStandard Germancan be realized as a uvular fricative (χ/ʁ), a uvular approximant (ɹ), or a uvular tap or trill (ʀ/r).A phoneme may also be composed of multiple phones, such as thedipthongaʊin U.S. English (the "ow" in "cow").Supported languages ingruut-ipacontain aphonemes.txtfile in thegruut_ipa/datadirectory. This file has the following format:<phoneme> <example> [<replace> ...]where<phoneme>is a set of IPA letters, likeɶoraʊ. The<example>is a word whose pronunciation contains the<phoneme>. After that, there are one or more optional<replace>strings that will be replaced with<phoneme>. The German/r/example from above might be represented as:r brot χ ʁ ɹ ʀPhonemes for a given language come fromphonological analysesand frompublic databases. Ultimately, they are geared towards capturing pronunciations fromWiktionary.UsagePrint JSON information about phones:$python3-mgruut_ipadescribe"ˈãː"|jq.{"text":"ˈãː","letters":"a","stress":"primary","height":"open","placement":"front","rounded":false,"type":"Vowel","nasalated":true,"elongated":true}Split an IPA pronunciation into phones:$python3-mgruut_ipaphones"ˈjɛs|ˈt͡ʃuːz aɪpiːeɪ‖"ˈjɛs|ˈt͡ʃuːzaɪpiːeɪ‖Group phones into phonemes for a specific language:$python3-mgruut_ipaphonemesen-us"/dʒʌst ə kaʊ/"d͡ʒʌstəkaʊConvert between IPA,espeak, andsampa:$python3-mgruut_ipaconvertipaespeak"mʊmˈbaɪ"[[mUm'baI]]$ python3 -m gruut_ipa convert espeak ipa "[[D,Is Iz sVm f@n'EtIkt'Ekst 'InpUt]]"ðˌɪs ɪz sʌm fɘnˈɛtɪk tˈɛkst ˈɪnpʊtChain commands together:$python3-mgruut_ipaconvertespeakipa"[[k'aU]]"|\python3-mgruut_ipaphonemesen-us--keep-stress
kˈaʊAlternative Phoneme SetsSome languages have multiple phoneme sets available:U.S. English (en-us)CMUDict (en-us/cmudict)Zamia(en-us/zamia)Swahili (sw)ALFFA(sw/alffa)Convert from IPA to alternative phoneme set:$python3-mgruut_ipaconvertipaen-us/cmudict"h ɛ l ˈoʊ w ˈɚ l d"HHEH0LOW1WER1LDConvert from alternative phoneme set to IPA:$python3-mgruut_ipaconverten-us/cmudictipa"HH EH0 L OW1 W ER1 L D"hɛlˈoʊwˈɚldScriptsUse thespeak-ipascript to haveespeakpronounce IPA. You may need toapt-get install espeakfirst.$echo'/hɛloʊ wɝld/'|bin/speak-ipaen-us-s60-w'hello world.wav'$aplay'hello world.wav'PhonesSupported IPA phones can be printed with:$python3-mgruut_ipaprint{"text":"i","letters":"i","stress":"none","height":"close","placement":"front","rounded":false,"type":"Vowel","nasalated":false,"elongated":false,"description":"close front unrounded vowel","espeak":"i","sampa":"i"}{"text":"y","letters":"y","stress":"none","height":"close","placement":"front","rounded":true,"type":"Vowel","nasalated":false,"elongated":false,"description":"close front rounded vowel","espeak":"y","sampa":"y"}...A nice table can be generated withjq:$python3-mgruut_ipaprint|\jq-r'. | "\(.text)\t\(.espeak)\t\(.sampa)\t\(.description)"'Converted to Markdown:IPAeSpeakSampaDescriptioniiiclose front unrounded vowelyyyclose front rounded vowelɨi"1close central unrounded vowelʉu"}close central rounded vowelɯu-Mclose back unrounded voweluuuclose back rounded vowelɪIInear-close near-front unrounded vowelʏI.Ynear-close near-front rounded vowelʊUUnear-close near-back rounded voweleeeclose-mid front unrounded voweløY2close-mid front rounded vowelɘ@@\close-mid central unrounded vowelɵ@.8close-mid central rounded vowelɤo-7close-mid back unrounded voweloooclose-mid back rounded vowelɛEEopen-mid front unrounded vowelœW9open-mid front rounded vowelɜV"3open-mid central unrounded vowelɞO"3\open-mid central rounded vowelʌVVopen-mid back unrounded vowelɔOOopen-mid back rounded vowelæa{near-open front unrounded vowelɐV6near-open central unrounded vowelaaaopen front unrounded vowelɶW&open front rounded vowelɑAAopen back unrounded vowelɒA.Qopen back rounded vowelmmmvoiced bilabial nasalɱMFvoiced labio-dental nasalnnnvoiced alveolar nasalɳn.n`voiced retroflex nasalŋNNvoiced velar nasalɴn"N\voiced uvular nasalpppvoiceless bilabial plosivebbbvoiced bilabial plosivetttvoiceless alveolar plosivedddvoiced alveolar plosiveʈt.t`voiceless retroflex plosiveɖd.d`voiced retroflex plosivecccvoiceless palatal plosiveɟJJ\voiced palatal plosivekkkvoiceless velar plosiveɡggvoiced velar plosivegggvoiced velar plosiveqqqvoiceless uvular plosiveɢGG\voiced uvular plosiveʡ>\voiceless pharyngeal plosiveʔ??voiceless glottal plosivep͡fpfpfvoiceless labio-dental affricateb͡vbvbvvoiced dental affricatet̪͡stst_dsvoiceless dental affricatet͡ststsvoiceless alveolar affricated͡zdzdzvoiced alveolar affricatet͡ʃtStSvoiceless post-alveolar affricated͡ʒdZdZvoiced post-alveolar affricateʈ͡ʂtSts`voiceless retroflex affricateɖ͡ʐdzdz`voiced retroflex affricatet͡ɕtS;ts\voiceless palatal affricated͡ʑdZ;dz\voiced palatal affricatek͡xkk_xvoiceless velar affricateɸFp\voiceless bilabial fricativeβBBvoiced bilabial fricativefffvoiceless labio-dental fricativevvvvoiced labio-dental fricativeθTTvoiceless dental fricativeðDDvoiced dental fricativesssvoiceless alveolar fricativezzzvoiced alveolar fricativeʃSSvoiceless post-alveolar fricativeʒZZvoiced post-alveolar fricativeʂs.s`voiceless retroflex fricativeʐz.z`voiced palatal fricativeçCCvoiceless palatal fricativexxxvoiceless velar fricativeɣQGvoiced velar fricativeχXXvoiceless uvular fricativeʁg"Rvoiced uvular fricativeħHX\voiceless pharyngeal fricativehhhvoiceless glottal fricativeɦh<?>h\voiced glottal fricativewwwvoiced bilabial approximantʋv#v\voiced labio-dental approximantɹrr\voiced alveolar approximantɻr.r\`voiced retroflex approximantjjjvoiced palatal approximantɰQM\voiced velar approximantⱱⱱⱱvoiced labio-dental flapɾ*4voiced alveolar flapɽ*.r`voiced retroflex flapʙbB\voiced bilabial trillrrrvoiced alveolar trillʀr"R\voiced uvular trilllllvoiced alveolar lateral-approximantɫl5voiced alveolar lateral-approximantɭl.l`voiced retroflex lateral-approximantʎl^Lvoiced palatal lateral-approximantʟLL\voiced velar lateral-approximantə@@schwaɚ3@`r-coloured schwaɝ3@`r-coloured schwaɹ̩r-r\̩voiced alveolar approximantIf you see anything wrong or missing, please let me know.