Page MenuHomePhabricator

Limit number of IPA characters for Phonos
Closed, ResolvedPublic2 Estimated Story Points

Description

As mentioned in T314297#8184833, we should apply an upper limit to the number of IPA characters — for example, tɐʉmɐtɐ.​ɸɐkɐtɐŋihɐŋɐ.​koːɐʉɐʉ.​ɔ.​tɐmɐtɛɐ.​tʉɾi.​pʉkɐkɐ.​piki.​mɐʉŋɐ.​hɔɾɔ.​nʉkʉ.​pɔkɐi.​ɸɛnʉɐ.​ki.​tɐnɐ.​tɐhʉ (111 chars) is the IPA for Taumatawhakatangi­hangakoauauotamatea­turipukakapikimaunga­horonukupokaiwhen­uakitanatahu (89 chars), so we could apply an arbitrary cap to the accepted IPA (300 bytes)

Acceptance criteria

When passed an IPA string under 300 bytes:

  • The phonos button is in the active state and plays the rendered audio when clicked

When passed an IPA string with over 300 bytes:

  • The phonos button is in the disabled state and shows an error message (en: IPA too long to render. / qqq: phonos-ipa-too-long)

Event Timeline

so we could apply an arbitrary cap to the accepted IPA (i.e. 300 chars?)

This sounds good to me, thanks for finding that long example! Sounds like 300 is a safe cap, and it also sounds like it would not be that difficult to make it higher if we discover that the cap was off for other unknown edge cases. Dragging to Sprint 33.

Just for reference, the 111 character IPA string (tɐʉmɐtɐ.​ɸɐkɐtɐŋihɐŋɐ.​koːɐʉɐʉ.​ɔ.​tɐmɐtɛɐ.​tʉɾi.​pʉkɐkɐ.​piki.​mɐʉŋɐ.​hɔɾɔ.​nʉkʉ.​pɔkɐi.​ɸɛnʉɐ.​ki.​tɐnɐ.​tɐhʉ) is 187 bytes, and strlen() returns the byte count — I still think 300 bytes is a reasonable arbitrary cap

Design/product question for @JFernandez-WMF / @NRodriguez — when over the IPA count limit, what should happen? Ideally we'd indicate to the user that the IPA was too long..

Change 831112 had a related patch set uploaded (by Samtar; author: Samtar):

[mediawiki/extensions/Phonos@master] [WIP] Phonos.php: Limit number of IPA characters for Phonos

https://gerrit.wikimedia.org/r/831112

TheresNoTime changed the task status from Open to Stalled.Sep 9 2022, 4:00 PM

Stalling on T316641#8225002 :)

TheresNoTime changed the task status from Stalled to Open.Sep 13 2022, 8:21 AM

Change 831112 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] Phonos.php: Limit number of IPA characters for Phonos

https://gerrit.wikimedia.org/r/831112

When testing just under 300 bytes, it worked fine in generating the audio file. I received a different error though when going over 300 bytes as seen in the screenshot (Failed to generate the audio file using the Larynx engine: There was a problem during the HTTP request: 500 Internal Server Error.) @TheresNoTime

Tested on Patch demo link: https://patchdemo.wmflabs.org/wikis/63cd762b6b/wiki/Phonos

Google Chrome

Phonos_IPA Limit_Fail.png (952×3 px, 194 KB)

TheresNoTime set the point value for this task to 2.

Okay finally, the actual error from Larynx is "AssertionError: No phoneme for lexeme: Lexeme(grapheme='helllo', phonemes=None, roles=None)" — it seems the request is still being sent with a blank phoneme

Change 838701 had a related patch set uploaded (by Samtar; author: Samtar):

[mediawiki/extensions/Phonos@master] Phonos: Throw PhonosException if IPA > 300 bytes

https://gerrit.wikimedia.org/r/838701

Change 838701 merged by jenkins-bot:

[mediawiki/extensions/Phonos@master] Phonos: Throw PhonosException if IPA > 300 bytes

https://gerrit.wikimedia.org/r/838701

Test wiki created on Patch demo by GMikesell-WMF using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/ede8b9e520/w

@TheresNoTime It is now showing successfully that the phonos button is in the disabled state and shows an error message of IPA too long to render as seen in the screenshot (F35551026)

If there is nothing else, I will move this to Production sign-off. Thanks!

IPA Greater than 300 Bytes Error_PASS.png (499×3 px, 116 KB)

Patch Demo Link tested on: https://patchdemo.wmflabs.org/wikis/ede8b9e520/wiki/Main_Page
OS: Windows
Browser: Chrome

Test wiki on Patch demo by GMikesell-WMF using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/ede8b9e520/w/