Handy tools to manipulate korean character.

hangul logo

About hangul

hangul is a set of handy tools for manipulate korean character in Go language.

GoDoc Build Status

Example

package main

import (
        "fmt"
        hangul "github.com/suapapa/go_hangul"
)

func main() {
        var i, m, f, ci, cm, cf rune
        var c int
        for _, r := range "맥도날드" {
                // Storke count
                c = hangul.Stroke(r)
                // Split to three elements
                i, m, f = hangul.Split(r)
                // Convert between jamo and compatibility-jamo
                ci = hangul.CompatJamo(i)
                cm = hangul.CompatJamo(m)
                cf = hangul.CompatJamo(f)

                fmt.Printf("%c %d %c(%v) %c(%v) %c(%v)\n", r, c, ci, i, cm, m, cf, f)
        }
        fmt.Println("")

        fmt.Println(
            hangul.EndsWithConsonant("강")) // true
        fmt.Println(
            hangul.EndsWithConsonant("그")) // false
        fmt.Println(
            hangul.AppendPostposition("강", "이", "가")) // "강이"
        fmt.Println(
            hangul.AppendPostposition("물고기", "은", "는")) // "물고기는"
}

Installation

$ go get github.com/suapapa/go_hangul

Author

Homin Lee <[email protected]>

Copyright & License

Copyright (c) 2012, Homin Lee. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Comments
  • AppendPostposition for (으)로

    AppendPostposition for (으)로

    Thanks for the very useful library to manipulate Hangul letters.

    AppendPostposition() takes the allomorphs of a postposition at with and without. The choice between with and without depends on only the prior final consonant. This implementation works well and is enough in most cases. But there's one exception.

    (으)로 becomes after a vowel. Also, it becomes 으로 after a final consonant EXCEPT . After a final , (으)로 becomes , not 으로.

    Check the below examples:

    학교로 (로 after a final consonant)
    집으로 (으로 after a vowel)
    마을로 (로 after a final ㄹ)
    
  • Revive EndsWithConsonant for backward compatibility

    Revive EndsWithConsonant for backward compatibility

    Now EndsWithConsonant is obsolete due to LastConsonant but some libraries which depend on go_hangul may still require it. Also, we still can find it in README. So for backward compatibility, it should remain.

  • CP949 out of index error

    CP949 out of index error

    github.com/suapapa/go_hangul/encoding/cp949/cp949.go in func (p *translateFromCp949) Translate() for len(data) > 0 { // <- allow length 1 data slice ... n := uint16(data[0])<<8 | uint16(data[1]) // <- data[1] is out of index. ... }

  • Add final consonant(종성) utilities

    Add final consonant(종성) utilities

    Changes

    Added two functions:

    • EndsWithConsonant determines whether the given word ends with consonant or not.
    • AppendPostposition concatenates the given word and proper postposition(조사).

    Both functions are taking string arguments for the sake of convenience.

  • godoc.org에 올라간 API 설명이 반대로 된 것 같아요...

    godoc.org에 올라간 API 설명이 반대로 된 것 같아요...

    From(): convert utf-8 stream to cp949 stream To(): convert cp949 stream to utf-8 stream

    이렇게 서술되어 있는데, 반대로 된 것 같아요.. 실제로 windows에서 저장된 파일(노트패드로)을 To()로 변환하면 올바르게 utf-8 string으로 변환되지 않고, From()으로 변환하면 올바르게 변환되더라구요..

    간단한 토이 프로그램을 작성했는데 iconv를 쓸 수 없는 상황이고 윈도까지 지원해야 하는 상황이라 난감했었는데, 좋은 라이브러리 덕분에 해결되었습니다. 감사합니다. :)

Zero-width character detection and removal for Go

go-zero-width Zero-width character detection and removal for Go. Inspired by this Medium article. Installation go get github.com/trubitsyn/go-zero-wid

Jan 8, 2023
character-set conversion library implemented in Go

mahonia character-set conversion library implemented in Go. Mahonia is a character-set conversion library implemented in Go. All data is compiled into

Dec 22, 2022
An anthology of a variety of tools for the Persian language in Golang
An anthology of a variety of tools for the Persian language in Golang

Persian tools An anthology of a variety of tools for the Persian language in Golang Todos Bill calculator Digits Validate Bank card number. Find Bank'

Nov 22, 2022
Tools to help with Japanese sentence mining

Tools to help with Japanese sentence mining

Oct 25, 2022
Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.
Produces a set of tags from given source. Source can be either an HTML page, Markdown document or a plain text. Supports English, Russian, Chinese, Hindi, Spanish, Arabic, Japanese, German, Hebrew, French and Korean languages.

Tagify Gets STDIN, file or HTTP address as an input and returns a list of most popular words ordered by popularity as an output. More info about what

Dec 19, 2022
A personal collection of handy CLI tools

Toolkit A personal collection of handy CLI tools Installation 1.) Download and extract the ZIP package for the the latest release 2.) Copy the appropr

Nov 8, 2021
siusiu (suite-suite harmonics) a suite used to manage the suite, designed to free penetration testing engineers from learning and using various security tools, reducing the time and effort spent by penetration testing engineers on installing tools, remembering how to use tools.
siusiu (suite-suite harmonics) a suite used to manage the suite, designed to free penetration testing engineers from learning and using various security tools, reducing the time and effort spent by penetration testing engineers on installing tools, remembering how to use tools.

siusiu (suite-suite harmonics) a suite used to manage the suite, designed to free penetration testing engineers from learning and using various security tools, reducing the time and effort spent by penetration testing engineers on installing tools, remembering how to use tools.

Dec 12, 2022
Zero allocation Nullable structures in one library with handy conversion functions, marshallers and unmarshallers

nan - No Allocations Nevermore Package nan - Zero allocation Nullable structures in one library with handy conversion functions, marshallers and unmar

Dec 20, 2022
Go package for OCR (Optical Character Recognition), by using Tesseract C++ library

gosseract OCR Golang OCR package, by using Tesseract C++ library. OCR Server Do you just want OCR server, or see the working example of this package?

Jan 3, 2023
A handy, fast and powerful go template engine.
A handy, fast and powerful go template engine.

Hero Hero is a handy, fast and powerful go template engine, which pre-compiles the html templates to go code. It has been used in production environme

Dec 27, 2022
Zero-width character detection and removal for Go

go-zero-width Zero-width character detection and removal for Go. Inspired by this Medium article. Installation go get github.com/trubitsyn/go-zero-wid

Jan 8, 2023
character-set conversion library implemented in Go

mahonia character-set conversion library implemented in Go. Mahonia is a character-set conversion library implemented in Go. All data is compiled into

Dec 22, 2022
Find out where you fall on the Open-Source Character Alignment Chart

gitaligned Find out where you fall on the Open-Source Character Alignment Chart Binaries available in releases. If you prefer to install from source,

Dec 28, 2022
Handy commands to run in Go projects

Handy commands to run in Go projects

Jan 3, 2023
Handy little CLI for interacting with OCI data

oci-tool Handy little CLI for interacting with OCI data Installation go get github.com/csweichel/oci-tool I use Gitpod for developing this tool; you s

May 17, 2022
Aces is a command line utility that lets you encode any file to a character set of your choice.

Aces Any Character Encoding Set Aces is a command line utility that lets you encode any file to a character set of your choice. For example, you could

Nov 28, 2022
Handy Kakoune companion.

kks Handy Kakoune companion. Installation Download release binary Download the compiled binary for your system from Releases page and put it somewhere

Dec 10, 2022
Convert Arabic numeric amounts to Chinese character

将阿拉伯数字金额转换为汉字的形式 Convert Arabic numeric amounts to Chinese character form. 安装使用 Golang 版本大于等于1.16 go get -u github.com/aliliin/rmb-character import (

Sep 9, 2021
krconv -- Convert kana-character to roman-alphabet
 krconv -- Convert kana-character to roman-alphabet

krconv -- Convert kana-character to roman-alphabet Convert kana-characters to roman-alphabets (by hepburn romanization) This package is required Go 1.

Aug 8, 2022
A simple APIRest to Star Wars character using Golang (gin,gorm)
A simple APIRest to Star Wars character using Golang (gin,gorm)

A simple APIRest to Star Wars character using Golang (gin,gorm)

Sep 23, 2021