dzcpy/transliteration

Not working for Thai

stephankn opened this issue · 6 comments

Completely broken for Thai.

Try เชียงใหม่

Should​ be Chiang Mai. Official scheme for Thai is RTGS.

Your transliteration looks as broken as ICU.

dzcpy commented

You are right, Thai seems not supported. I'll add this in caveats section. Meanwhile, do you know any open source script which can transliterate Thai into Latin?

Sorry, don't know anything better. I search from time for something RTGS capable. This is how I came across yours, just to discover it being broken as well.
If someone finds open source capable of transliteration with RTGS I would be happy to learn about it, too.

dzcpy commented

@stephankn I found one, it's not accurate but kind of working: https://github.com/comdevx/thai2karaoke
Here is the test code:

const { thai2karaoke: thai } = require('thai2karaoke')();
const res = {
  status() {
    return this;
  },
  json(res) {
    console.log(res.data);
  }
}
let result = thai({ body: { text: 'เชียงใหม่' } },  res);
console.log(result);

Below are some links about the rules to transliterate Thai using RTGS:
http://www.arts.chula.ac.th/~ling/tts/principles_eng.pdf
https://en.wikipedia.org/wiki/Royal_Thai_General_System_of_Transcription

I'm not quite familiar with Thai, if any one can help coding the conversion rules, I can merge it into this module.
Here is a place where you can test whether the result is correct:
http://www.thai-language.com/?nav=dictionary&anyxlit=1

Another service for testing transliteration
https://www.thai2english.com/transliteration

Meanwhile I found this one to work quite well for Thai: https://pypi.org/project/tltk/

Saw this thread is quite old, but just hit this issue as I'm currently relying on this library for other languages and just onboarded Thai. I'm wondering if there has been any progress made here, and also if anyone knows of any alternative libraries that support Node.js. Thank you!