This documentation is for Ruby specific usage of Myanmar Tools. For general documentation, see the top-level README.
Prerequisites: Ruby >= 2.0.0-p0 and bundler >= 1.0
Add the dependency to your project:
$ gem install myanmar-tools
or
$ bundle add myanmar-tools
To detect Zawgyi, create an instance of ZawgyiDetector, and call get_zawgyi_probability
with your string.
require 'myanmar-tools'
detector = MyanmarTools::ZawgyiDetector.new
score = detector.get_zawgyi_probability('အျပည္ျပည္ဆိုင္ရာ လူ႔အခြင့္အေရး ေၾကညာစာတမ္း')
# score is 1.0 (The input is definitely Zawgyi)
To convert from Zawgyi to Unicode, you can use the Ruby wrapper over icu4c. Install it like this:
$ gem install icu
or
$ bundle add icu
Then convert from Z to U like this:
require 'icu'
converter = ICU::Transliterator.new "Zawgyi-my"
output = converter.transliterate("မ္း")
# output is now "မ်း"
For a complete working example, see samples/ruby/demo.rb.
Bug reports and pull requests are welcome on GitHub at https://github.com/google/myanmar-tools . This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the Apache-2.0 License.
Everyone interacting in the Myanmar-Tools project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.