rhasspy / gruut-ipa

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

Consonant descriptions missing manner #11

Open trenslow opened 2 years ago

trenslow commented 2 years ago

Hi,

I recently stumbled on this project and I have to say I'm quite impressed. It's a fresh take on all the other projects related to IPA in Python. Keep it up!

One thing I noticed while playing around was that in the consonant descriptions, we don't see the manner of articulation, neither from the command line nor when calling it from code. For example:

## command line
python -m gruut_ipa describe 'f' | jq .
{
  "text": "f",
  "letters": "f",
  "tone": "",
  "tones": [],
  "accents": [],
  "stress": "",
  "type": "Consonant",
  "place": "labio-dental",
  "voiced": false,
  "nasalated": [],
  "raised": [],
  "elongated": false
}

## from python script
gruut_ipa.Phoneme('f').to_dict()
{'text': 'f',
 'letters': 'f',
 'tone': '',
 'tones': [],
 'accents': [],
 'stress': '',
 'type': 'Consonant',
 'place': 'labio-dental',
 'voiced': False,
 'nasalated': [],
 'raised': [],
 'elongated': False}

I can tell the information is there if I call the consonant object, it just seems like the information is lost when converting this object to the dict/json output.

gruut_ipa.Phoneme('f').consonant
Consonant(ipa='f', type=<ConsonantType.FRICATIVE: 'fricative'>, place=<ConsonantPlace.LABIO_DENTAL: 'labio-dental'>, voiced=False, velarized=False, sounds_like=<ConsonantSoundsLike.NONE: ''>, length=<PhonemeLength.NORMAL: 'normal'>, alias_of=None)

I think it has to do with the code in the main file calling for the 'type' of the consonant object, but I'm not in a position to debug it at the moment. The internal type is fricative and the python type is Consonant. This could be fixed by example by referring to the consonant 'type' as the consonant 'manner', which is in line with IPA standards.

Looking forward to your feedback. Thanks again for the awesome tool!