IPAValidator
Validation and normalization of IPA
|
When constructing a new Validator
, you can set the following options:
This option will remove some delimiters from the IPA — currently /.../
and [...]
When $google
is false
, this option will normalize the IPA and remove commonly mistaken unicode characters (for example, using :
instead of ː
in a word such as tenoːt͡ʃˈtit͡ɬan
).
As part of a work project, we're feeding IPA to Google's TTS engine — Google is a little opinionated about things like diacritics. For example, the IPA ˈɔːfɫ̩
would not render correctly in Google TTS. A custom charmap is used to normalize certain characters:
Setting $google
to true
also removes all diacritics from the IPA string.
I've also placed it at https://regex101.com/r/f2Qhuk if you think you can improve it... (please do!)