Giter VIP home page Giter VIP logo

jamo's Introduction

golang-jamo

Hangeul character syllable decomposing/composing Go library

License contributors ymw0407/jamo repository's last-commit ymw0407/jamo repository's issues github release github last release date ymw0407/jamo repository's stars ymw0407/jamo repository's forks ymw0407/jamo repository's watchers

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

go get -u github.com/ymw0407/jamo

Usage/Examples

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.

License

jamo is released under Apache License 2.0. See the LICENSE file for details.

jamo's People

Contributors

open-set-go avatar ymw0407 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.