Giter Club home page Giter Club logo

gomigemo's Introduction

gomigemo

test pkg.go.dev

ローマ字のまま日本語をインクリメンタル検索するためのツールであるMigemoを、Go言語で実装したものです。

C/Migemoとの比較

項目 C/Migemo gomigemo
実行ファイルサイズ(KB) 72 1974
辞書ファイルサイズ(MB) 4.78 2.03
メモリ使用量(MB) 26.1 12.1
起動時間(ms) 198 78
クエリ時間(ms) 5053 5860

詳細はmigemo-benchmarkを参照してください。

ビルド方法

> go build -ldflags="-s -w" -trimpath

使い方

CLI

gomigemoの利用には、辞書ファイルが必要です。 migemo-compact-dict-latest から migemo-compact-dict をダウンロードし、 作業フォルダ(シェルのカレントディレクトリ)に配置してください。 なお、migemo-compact-dict のライセンスはGPLv3のため、再配布する際はご注意ください。

> ./gomigemo.exe -h
Usage of C:\...\gomigemo.exe:
  -d string
        Use a file <dict> for dictionary. (default "migemo-compact-dict")
  -e    Use emacs style regexp.
  -n    Don't use newline match.
  -p int
        <port> number for HTTP server.
  -q    Show no message except results.
  -v    Use vim style regexp.
  -w string
        Expand a <word> and soon exit.
> ./gomigemo.exe -w kensaku
(kensaku|けんさく|ケンサク|建策|憲[作冊]|検索|献策|研削|羂索|kensaku|ケンサク)

HTTP

gomigemoはHTTPサーバとして動かすことができます。 コマンドライン引数 -p <port> で、サーバのポート番号を指定すると、HTTPサーバとして起動します。

> ./gomigemo.exe -p 8080

指定したポート番号に /migemo?q=<word> にGETメソッドでアクセスすると、 <word> の文字列がMigemoの正規表現として返ってきます。 クエリ文字列qを複数つなげると、複数Migemoの処理が同時に行われ、順に改行されて返されます。

> ./curl.exe  "localhost:8080/migemo?q=migemo&q=kensaku"
(migemo|みげも|ミゲモ|migemo|ミゲモ)
(kensaku|けんさく|ケンサク|建策|憲[作冊]|検索|献策|研削|羂索|kensaku|ケンサク)

ライセンス

MIT Licenseの下で配布しています。

gomigemo's People

Contributors

oguna avatar

Stargazers

Gota Okabe avatar arrow2nd avatar  avatar KUDO Shunsuke avatar

Watchers

James Cloos 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.