Code Monkey home page Code Monkey logo

go-kakasi's Introduction

go-kakasi

go-kakasi is a C binding library of kakasi. Just wraps pre-built library, you can use kakasi in your Go program.

Requirements

  • Go: We built with 1.16beta1, I appreciate if you can ensure it's be able to build with older version :-)
  • gcc

Usage

This package bundles prebuilt static library, therefore you don't worry what cgo does:

package main

import (
  "log"
  "github.com/ysugimoto/go-kakasi"
)

func main() {
  text := "日本語"
  transformed, err := kakasi.Transform(text, kakasi.WithKanji(kakasi.ASCII))
  if err != nil {
    log.Fatalln(err)
  }
  log.Printf("Transformed: %s -> %s\n", text, transformed)
}

Customize / Transform Options

go-kakasi accepts transform option as kakasi.WithXXX which corresponds to original kakasi transformation mode.

Option Accept Character remarks
WithWakatigaki() - Enable wakatigaki mode
WithCapitalize() - Enable Capitalize mode, only enables -Ja or -Jj option)
WithUppercase() - Enable Upcase mode, only enables -Ja or -Jj option)
WithFurigana - Enable Furigana mode.
WithHiragana(Character) kakasi.ASCII, kakasi.JISROMAN, kakasi.KatakanaJIS0201, kakasi.Katakana Set Hiragana transformation mode.
WithKatakana(Character) kakasi.ASCII, kakasi.JISROMAN, kakasi.KatakanaJIS0201, kakasi.Hiragana Set Katakana transformation mode.
WithKatakanaJIS0201(Character) kakasi.ASCII, kakasi.JISROMAN, kakasi.Katakana, kakasi.Hiragana Set KatakanaJIS0201 transformation mode.
WithKanji(Character) kakasi.ASCII, kakasi.JISROMAN, kakasi.KatakanaJIS0201, kakasi.Katakana, kakasi.Hiragana Set Kanji transformation mode.
WithASCII(Character) kakasi.JISROMAN, kakasi.Sign Set ASCII transformation mode.
WithJISROMAN(Character) kakasi.ASCII, kakasi.Sign Set JISROMAN transformation mode.
WithGraphic(Character) kakasi.ASCII, kakasi.JISROMAN, kakasi.Sign Set Graphic transformation mode.
WithSign(Character) kakasi.ASCII, kakasi.JISROMAN Set Sign transformation mode.

Development

Currently, this package uses kakasi stable version of 2.3.6, build and tested following environments:

  • darwin: OS X 10.15.7 (Catalina)
  • linux: Ubuntu 16.04 (Xenial, in docker)
  • linux: Debian 10 (buster, in CircleCI using go1.15.7)

If you want to build kakasi for your environment, You can rebuilt static library as following:

git checkout https://github.com/ysugimoto/go-kakasi
cd go-kakasi
# Build kakasi in your environment
make all
# Note that if you're linux, it will be overriden `deps/linux/*` files.

I appreciate it you let me know some other environment also works fine (especially Windows!)

License

GNU General Public License, vesion 2 https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html

Author

Yoshiaki Sugimoto

And, very thanks for kakasi's anthor: Hironobu Takahasi

go-kakasi's People

Contributors

ysugimoto avatar

Stargazers

Dawid Ciepiela avatar paylanon avatar liangzh avatar ovo avatar miuros avatar Kishore Nallan avatar Kaito Iwatsuki avatar Shotaro Ishihara avatar

Watchers

 avatar  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.