This documentation is for Swift specific usage of myanmar-tools.
Cocoapods
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate ZawgyiDetector into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'zawgyidetector', '~> 1.2'
Carthage
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate ZawgyiDetector into your Xcode project using Carthage, specify it in your Cartfile
:
github "lawinko/ZawgyiDetector" ~> 1.2
Create a singleton instance of ZawgyiDetector class and pass input string that you want to predict into predict function.
import zawgyidetector
let detector = ZawgyiDetector.shared
detector.predict(input: "မ္း")
// score is now 0.999772 (very likely Zawgyi)
Returns negative infinity when input is not burmese
let rawStr = "hello, world"
let probability = detector.predict(input: rawStr) // returns -Inf
if probability.isInfinite {
// Not burmese text. No need to convert
}
You can check on this - https://github.com/Rabbit-Converter/Rabbit-Swift