https://github.com/lawinko/zawgyidetector
This repository is customized platform support of https://github.com/google/myanmar-tools to use in iOS and macOS by Swift language.
https://github.com/lawinko/zawgyidetector
burmese carthage cocoapods detect-language objective-c swift unicode
Last synced: about 1 month ago
JSON representation
This repository is customized platform support of https://github.com/google/myanmar-tools to use in iOS and macOS by Swift language.
- Host: GitHub
- URL: https://github.com/lawinko/zawgyidetector
- Owner: lawinko
- License: apache-2.0
- Created: 2020-06-10T17:40:22.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-27T10:22:03.000Z (over 3 years ago)
- Last Synced: 2025-04-04T16:44:44.484Z (about 1 month ago)
- Topics: burmese, carthage, cocoapods, detect-language, objective-c, swift, unicode
- Language: Swift
- Size: 76.2 KB
- Stars: 16
- Watchers: 5
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Zawgyi Detector Documentation
This documentation is for *Swift* specific usage of [myanmar-tools](https://github.com/google/myanmar-tools).
## Installation
**Cocoapods**
[CocoaPods](https://cocoapods.org) 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`:
```ruby
pod 'zawgyidetector', '~> 1.2'
```**Carthage**
[Carthage](https://github.com/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`:
```ogdl
github "lawinko/ZawgyiDetector" ~> 1.2
```## Usage
Create a singleton instance of ZawgyiDetector class and pass input string that
you want to predict into predict function.
```swift
import zawgyidetectorlet detector = ZawgyiDetector.shared
detector.predict(input: "မ္း")// score is now 0.999772 (very likely Zawgyi)
```Returns negative infinity when input is not burmese
```swift
let rawStr = "hello, world"
let probability = detector.predict(input: rawStr) // returns -Infif probability.isInfinite {
// Not burmese text. No need to convert
}
```## Zawgyi <-> Unicode conversion
You can check on this - https://github.com/Rabbit-Converter/Rabbit-Swift