Myanmar Tools for Flutter는 미얀마(버마어) 텍스트 처리를 위한 유틸리티를 제공하며, 스크립트 변환, 음절 분할 및 폰트 렌더링을 포함합니다. 이는 원래 자바로 개발된 구글의 Myanmar Tools 라이브러리의 Dart 버전입니다. 이 패키지는 여러 플랫폼에서 미얀마 문자의 정확한 렌더링과 조작을 지원하여 Flutter 앱에서 버마어 콘텐츠가 올바르게 표시되고 처리되도록 보장합니다. 미얀마 사용자를 대상으로 하는 앱이나 버마어 언어 지원이 필요한 앱에 적합합니다.
사용 사례
미얀마 사용자를 위한 앱 로컬라이제이션
버마어 텍스트 입력 처리
미얀마 문자를 올바르게 렌더링하기
음절 수준의 텍스트 분석
버마어 타이포그래피 지원
다국어 앱과의 통합
주요 기능
미얀마 문자 분할
버마어를 위한 유니코드 정규화
글꼴 백업 및 렌더링 지원
크로스 플랫폼 호환성
Dart로 이식된 Java 라이브러리
텍스트 레이아웃 최적화
적합한 대상
미얀마를 대상으로 한 플러터 앱
국제화 라이브러리
버마어 언어 처리
교육 또는 정부 앱
복잡한 텍스트 레이아웃을 가진 앱
정확한 스크립트 처리가 필요한 개발자
고려 사항
유니코드 문자를 주의 깊게 처리해야 합니다
기본 사용법을 넘어서는 문서가 제한적
시각적 일관성을 위해 추가적인 스타일링이 필요할 수 있습니다
미얀마 전용 폰트와 함께 사용하는 것이 가장 좋습니다
플랫폼별 렌더링 세부 사항
버마어가 아닌 스크립트에는 적합하지 않습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Myanmar Tools (Zawgyi detection & conversion)
This project includes tools for processing font encodings used in Myanmar, currently with support for the widespread Zawgyi-One font encoding. For more information on font encodings in Myanmar, read the Unicode Myanmar FAQ.
Supported in C++, Java, JavaScript (both Node.js and browser), PHP, Ruby, Dart and C#
Convert a string from Zawgyi to Unicode or from Unicode to Zawgyi
Supported in Java and JavaScript
Conversion is also available via ICU in languages without support via Myanmar Tools; see "Zawgyi-to-Unicode Conversion" below.
This is not an official Google product, but we hope that you’ll find Myanmar Tools useful to better support the languages of Myanmar.
Why Myanmar Tools?
Myanmar Tools uses a machine learning model to give very accurate results when detecting Zawgyi versus Unicode. Detectors that use hand-coded rules for detection are susceptible to flagging content in other languages like Shan and Mon as Zawgyi when it is actually Unicode.
Myanmar Tools and the CLDR Zawgyi conversion rules are used by Google, Facebook, and others to provide great experiences to users in Myanmar.
Depending on your programming language, a typical use case should look something like this:
if (zawgyiDetector.getZawgyiProbability(input) > THRESHOLD) {
// Convert to Unicode, etc.
}
The method getZawgyiProbability returns a number between 0 and 1 to reflect the probability that a string is Zawgyi, given that it is either Zawgyi or Unicode. For strings that are sufficiently long, the detector should return a number very close to 0 or 1, but for strings with only a few characters, the number may be closer to the middle. With this in mind, use the following heuristics to set THRESHOLD:
If under-predicting Zawgyi is bad (e.g., when a human gets to evaluate the result), set a low threshold like 0.05. This threshold guarantees that fewer than 1% of Zawgyi strings will go undetected.
If over-predicting Zawgyi is bad (e.g., when conversion will take place automatically), set a high threshold like 0.95. This threshold guarantees that fewer than 1% of Unicode strings will be wrongly flagged.
Additionally, keep in mind that you may want to tune your thresholds to the distribution of strings in your input data. For example, if your input data is biased toward Unicode, in order to reduce false positives, you may want to set a higher Zawgyi threshold than if your input data is biased toward Zawgyi. Ultimately, the best way to pick thresholds is to obtain a set of labeled strings representative of the data the detector will be processing, compute their scores, and tune the thresholds to your desired ratio of precision and recall.
If a string contains a non-Burmese affix, it will get the same Zawgyi probability as if the
affix were removed. That is, getZawgyiProbability("hello <burmese> world") ==
getZawgyiProbability("<burmese>").
Some strings are identical in both U and Z; this can happen if the string consists of mostly consonants with few diacritic vowels. The detector may return any value for such strings. If the user is concerned with this case, they can simply run the string through a converter and check whether or not the converter's output is equal to the converter's input.
Training the Model
The model used by the Zawgyi detector has been trained on several megabytes of data from web sites across the internet. The data was obtained using the Corpus Crawler tool.
To re-train the model, first run Corpus Crawler locally. For example:
This will take a long time, as in several days. The longer you let it run, the better your model will be. Note that at a minimum, you must ensure that you have obtained data for both Unicode and Zawgyi; the directory should contain files for the six languages listed in the commands above.
Once you have data available, train the model by running the following command in this directory:
$ make train CORPUS=$HOME/corpuscrawler_output
Zawgyi-to-Unicode Conversion
Once determining that a piece of text is Unicode or Zawgyi, it's often useful to convert from one encoding to the other.
This package supports conversion in Java and JavaScript. The rules are the same as the transliteration rules published in the Common Locale Data Repository (CLDR). In other languages, therefore, conversion functionality is available in ICU. Versions 58+ have this built-in with the transform ID "Zawgyi-my":
Many other languages, including Python, Ruby, and PHP, have wrapper libraries over ICU4C, which means you can use the Zawgyi converter in those languages, too. See the samples directory for examples on using the ICU Transliterator.
Contributing New Programming Language Support
We will happily consider pull requests that add clients in other programming languages. To add support for a new programming language, here are some tips:
Add a new directory underneath clients. This will be the root of your new package.
Use a build system customary to your language.
Add your language to the copy-resources and test rules in the top-level Makefile.
At a minimum, your package should automatically consume zawgyiUnicodeModel.dat and test against compatibility.tsv.
Implementations of converters should run compatibility tests for both Z<->U directions using the provide resources.
See the other clients for examples. Most clients are only a couple hundred lines of code.
When finished, add your client to the .travis.yml file.