Page MenuHomePhabricator

[4 hours] Investigate IPA validator methods
Closed, ResolvedPublicSpike

Description

T313494: Warn the user if they use unsupported IPA could be solved a lot easier if there is a pre-existing library/regex/etc. which would allow us to check inputted IPA strings

Event Timeline

TheresNoTime changed the subtype of this task from "Task" to "Spike".

Nothing really exists that I could find, so I threw together https://github.com/theresnotime/ipa-validator this evening, which has probably the most upsetting regex I've ever seen:

const regex = new RegExp('^[pbtdʈɖcɟkɡqɢʔmɱnɳɲŋɴʙrʀⱱɾɽɸβfvθðszʃʒʂʐçʝxɣχʁħʕhɦɬɮʋɹɻjɰlɭʎʟʘǀǃǂǁɓɗʄɠʛʼiyɨʉɯuɪʏʊeøɘj̊uɵɤoəɛœɜɞʌɔæɐaɶɑɒʍwɥʜʢʡɕʑɺɧ͜͡ˈˌːˑ̆|‖.‿̥̬ʰ̹̜̟̠̩̯̈̽˞̤̰̼ʷʲˠˤ̴̝̞̘̙̪̺̻̃ⁿˡ̋̚˥̌˩́˦̂̄˧᷄̀˨᷅̏᷈ɚ()ˀɝɫ̩]+$', 'gui');

The tests are fairly promising in terms of validating the correct Unicode etc..


https://github.com/theresnotime/php-ipa-validator