https://github.com/ymw0407/jamo
Hangeul character syllable decomposing/composing library
https://github.com/ymw0407/jamo
composing consonants decomposing-korean hangeul korean syllable syllable-segmentation syllables vowels
Last synced: 27 days ago
JSON representation
Hangeul character syllable decomposing/composing library
- Host: GitHub
- URL: https://github.com/ymw0407/jamo
- Owner: ymw0407
- License: apache-2.0
- Created: 2024-04-02T17:31:34.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-07T08:47:32.000Z (almost 2 years ago)
- Last Synced: 2024-06-19T16:37:16.555Z (over 1 year ago)
- Topics: composing, consonants, decomposing-korean, hangeul, korean, syllable, syllable-segmentation, syllables, vowels
- Language: Go
- Homepage: https://pkg.go.dev/github.com/ymw0407/jamo@v1.0.0#section-readme
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# golang-jamo
Hangeul character syllable decomposing/composing Go library
## Description
Golang-jamo is a Go Hangeul syllable decomposition/composition library for working with Hangul characters and jamo.
This library support Hangeul syllable decomposition with several options. (e.g. Detailed Jamo decomposition, Qwerty keyboard layout decomposition)
## Installation
```bash
go get -u github.com/ymw0407/jamo
```
## Usage/Examples
```go
package main
import (
"fmt"
"github.com/ymw0407/jamo/pkg/jamo"
"github.com/ymw0407/jamo/pkg/options"
)
func main() {
fmt.Println(
jamo.DecomposeHangeul("한글 테스트 예시!"),
) // "ㅎㅏㄴㄱㅡㄹ ㅌㅔㅅㅡㅌㅡ ㅇㅖㅅㅣ!"
fmt.Println(
jamo.DecomposeHangeul("한글 테스트 예시!", options.Jamo().SetComplexConsonants(true).SetDiphthong(true).SetTenseConsonants(true)),
) // "ㅎㅏㄴㄱㅡㄹ ㅌㅓㅣㅅㅡㅌㅡ ㅇㅕㅣㅅㅣ!"
fmt.Println(
jamo.DecomposeHangeul("한글 테스트 예시!", options.Qwerty().SetShiftOption(options.QwertyShiftOption1)),
) // "ㅎㅏㄴㄱㅡㄹ ㅌㅔㅅㅡㅌㅡ ㅇㅕㅣㅅㅣ!"
fmt.Println(
jamo.DecomposeHangeul("한글 테스트 예시!", *options.Qwerty().SetShiftOption(options.QwertyShiftOption2)),
) // "ㅎㅏㄴㄱㅡㄹ ㅌㅔㅅㅡㅌㅡ ㅇㅔㅔㅅㅣ!"
fmt.Println(
jamo.ComposeHangeul("ㅎㅏㄴㄱㅡㄹ"),
) // ["한글"], nil
fmt.Println(
jamo.ComposeHangeul("ㅎㅏㄴ ㄱㅡㄹ"), // any other characters except hangeul syllable is unavailable
) // [], JamoError.ErrImpossibleToCompose
fmt.Println(
jamo.ComposeHangeul("english"), // any other characters except hangeul syllable is unavailable
) // [], JamoError.ErrImpossibleToCompose
fmt.Println(
jamo.ComposeHangeul(
jamo.DecomposeHangeul("한글테스트예시", *options.Qwerty().SetShiftOption(options.QwertyShiftOption2)),
), // qwerty decomposition, jamo decomposition available to compose
) // ["한글테스트예시"], nil
fmt.Println(
jamo.ComposeHangeul(
jamo.DecomposeHangeul("ㄱㅡㄹㄱㄱㅣ", *options.Qwerty().SetShiftOption(options.QwertyShiftOption2)),
), // if it can be combined into several other characters, it returns all of them.
) // ["긁기", "글끼"], nil
}
```
## Contributers
Made with [contrib.rocks](https://contrib.rocks).
## License
jamo is released under Apache License 2.0.
See the [LICENSE file]("./LICENSE") for details.