Page MenuHomePhabricator

X-SAMPA support
Open, Needs TriagePublic

Description

Google TTS accepts X-SAMPA, an ASCII encoding of the IPA, in lieu of Unicode IPA.

(This is not a request or report but a placeholder for the topic, because I couldn't find one.)

Event Timeline

Am I right in thinking that the key change here would be to change the alphabet attribute in the SSML? Google's documentation has this example:

<phoneme alphabet="ipa" ph="ˌmænɪˈtoʊbə">manitoba</phoneme>

to

<phoneme alphabet="x-sampa" ph='m@"hA:g@%ni:'>mahogany</phoneme>

Would we add a new x-sampa="" attribute to the Phonos parser tag (that would not be able to be used in conjunction with ipa="")? Or because there's a deterministic mapping from IPA to X-SAMPA (is there?), do we instead translate the IPA? It looks like Wikidata doesn't have a X-SAMPA equivalent of IPA transcription (P898), I assume because it is possible to calculate it from IPA.

Is there any validation required or possible for the X-SAMPA value? I've done a very quick search and haven't found a PHP library for working with it. If we can do the mapping from IPA to X-SAMPA, should we use the mappings from Wikidata (e.g. ʊ, near-close near-back rounded vowel (Q1137807) maps to U)?

Samwilson changed the subtype of this task from "Task" to "Feature Request".Dec 8 2022, 7:03 AM

@Samwilson Like I said, this is not a request. More like an inquiry on whether you're going to support X-SAMPA.

Would we add a new x-sampa="" attribute to the Phonos parser tag (that would not be able to be used in conjunction with ipa="")? Or because there's a deterministic mapping from IPA to X-SAMPA (is there?), do we instead translate the IPA? It looks like Wikidata doesn't have a X-SAMPA equivalent of IPA transcription (P898), I assume because it is possible to calculate it from IPA.

I was thinking more like a type="x-sampa" or format="x-sampa" that specifies the type of the input (currently in ipa="", which would probably require renaming), i.e. something that directly translates to alphabet in SSML. If you're going to support Mandarin/Cantonese and therefore Pinyin/Jyutping as input, you're going to need something like that (since creating an attribute for every scheme that becomes available doesn't seem like a good long-term solution).

Is there any validation required or possible for the X-SAMPA value? I've done a very quick search and haven't found a PHP library for working with it. If we can do the mapping from IPA to X-SAMPA, should we use the mappings from Wikidata (e.g. ʊ, near-close near-back rounded vowel (Q1137807) maps to U)?

Wiktionary has Template:x2i that converts X-SAMPA to IPA (data: Module:IPA/data/X-SAMPA). As summarized here, X-SAMPA actually doesn't encode the entire IPA. And as we've established (I hope) at T323912, what is "valid IPA" is a shaky concept. For example, Google lists [p͈] for Korean, of which p* is listed as the X-SAMPA equivalent. But you won't find this in any X-SAMPA specs as [p͈] is not IPA (it's extIPA). Just like with IPA, trying to see if a string is "valid X-SAMPA" strikes me as a lost cause (I guess aside from the fact it must be all ASCII by its very nature).

So I don't actually recommend doing pretty much anything to "support", i.e. accommodate, X-SAMPA in Phonos other than to simply allow the user access to the alphabet option, so the flexibility offered by Google is offered to Phonos users as well.

Nardog changed the subtype of this task from "Feature Request" to "Task".Jul 6 2023, 1:25 AM