How to use the myanmar-tools.ZawgyiConverter function in myanmar-tools

To help you get started, we’ve selected a few myanmar-tools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / myanmar-tools / samples / node / index.js View on Github external
const assert = require("assert");
const google_myanmar_tools = require("myanmar-tools");

const detector = new google_myanmar_tools.ZawgyiDetector();
const converter = new google_myanmar_tools.ZawgyiConverter();

// Unicode string:
const input1 = "အပြည်ပြည်ဆိုင်ရာ လူ့အခွင့်အရေး ကြေညာစာတမ်း";
// Zawgyi string:
const input2 = "အျပည္ျပည္ဆိုင္ရာ လူ႔အခြင့္အေရး ေၾကညာစာတမ္း";

// Detect that the second string is Zawgyi:
const score1 = detector.getZawgyiProbability(input1);
const score2 = detector.getZawgyiProbability(input2);
assert(score1 < 0.001);
assert(score2 > 0.999);
console.log("Unicode Score:", score1.toFixed(6));
console.log("Zawgyi Score:", score2.toFixed(6));

// Convert the second string to Unicode:
const input2converted = converter.zawgyiToUnicode(input2);
github longjiang / zerotohero-cli / src / components / Annotate.vue View on Github external
convertBurmese(text) {
      console.log('converting burmese ' + text)
      const detector = new MyanmarTools.ZawgyiDetector()
      const score = detector.getZawgyiProbability(text)
      if (score > 0.5) {
        const converter = new MyanmarTools.ZawgyiConverter()
        console.log('Zawgyi detected')
        return converter.zawgyiToUnicode(text)
      } else {
        return text
      }
    },
    async recursive(node) {

myanmar-tools

Tools for handling the Zawgyi font encoding in Myanmar.

Apache-2.0
Latest version published 4 years ago

Package Health Score

54 / 100
Full package analysis