Skip to content

awa/nihongo

Repository files navigation

NihonGo

Build Status Coverage Status License

NihonGo is an utility of Japanese text for Go language.

go get github.com/dogenzaka/nihongo

Features

  • Converting Katakana / Hiragana
  • Unicode normalization
  • Detecting Katakana / Hiragana strings in text
  • Simple Japanese tokenizer ported TinySegmenter

Examples

import (
  "fmt"
  "github.com/dogenzaka/nihongo"
)

func TestNormalize() {
  normalized := nihongo.Normalize("テストテスト+=")
  fmt.Println(normalized) // テストテスト+=
}

func TestToHiragana() {
  hira := nihongo.ToHiragana("テストてすと")
  fmt.Println(hira) // てすとてすと
}

func TestToKatakana() {
  kana := nihongo.ToKatakana("テストてすと")
  fmt.Println(kana) // テストテスト
}

func TestTokenize() {
  words := nihongo.Tokenize("私は人間です")
  fmt.Println(words) // ["私" "は" "人間" "です"]
}

func TestContainsHiragana() {
  nihongo.ContainsHiragana("ひらがな") // true
  nihongo.ContiansHiragana("日本語") // false
}

func TestContainsKatakana() {
  nihongo.ContainsKatakana("カタカナ") // true
  nihongo.ContiansKatakana("日本語") // false
}

License

ISC

About

Japanese utilities for Go

Resources

License

ISC, Unknown licenses found

Licenses found

ISC
LICENSE
Unknown
LICENSE.tinysegmenter

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages