Skip to content

Instantly share code, notes, and snippets.

@otanim
Last active July 3, 2020 22:41
Show Gist options
  • Save otanim/80f0c31af8a03a4b27a1e2b69ed94400 to your computer and use it in GitHub Desktop.
Save otanim/80f0c31af8a03a4b27a1e2b69ed94400 to your computer and use it in GitHub Desktop.
Zawgyi to Unicode converter
//packages
const google_myanmar_tools = require('myanmar-tools');
const converter = new google_myanmar_tools.ZawgyiConverter();
const detector = new google_myanmar_tools.ZawgyiDetector();
const zawgyiToUnicode = (possiblyZawgyiText) => {
const hasToBeConverted = detector.getZawgyiProbability(possiblyZawgyiText) > 0.9;
const converted = hasToBeConverted ? converter.zawgyiToUnicode(possiblyZawgyiText) : possiblyZawgyiText;
return converted;
}
zawgyiToUnicode('လုပ္ငန္းရွင္မ်ား စာရင္းသုိ႕ ျပန္သြားရန');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment