Morphological Analyzer Comparator
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.circleci
cmd
static
.gitignore
LICENSE.txt
README.md
config.go
constraint.go
constraint_test.go
intset.go
ma.go
macomp.example.json
maresult.go
memo
pp.go
pp_test.go
todo.md

README.md

macomp: Morphological Analyzer Comparator

CircleCI Report card GoDoc Apache License

Usage

Initialize

First, initialize ~/.macomp.json to run the following command.

macomp --init

Modify it if you need.

macomp

See macomp -h for the detail.

$ macomp
宇宙にあるいて座
juman          |宇 宙||あ る い て||
jumanpp        |宇 宙||あ る い て||
mecab-ipa-NE   |宇 宙||あ る|い て 座|
mecab-unidic   |宇 宙||あ る い|||

$ macomp --pos --check
宇宙にある|いて?|
X juman          |宇 宙||あ る_い て||
                 |||||
X jumanpp        |宇 宙||あ る_い て||
                 |||||
O mecab-ipa-NE   |宇 宙||あ る|い て 座|
                 |||||
X mecab-unidic   |宇 宙||あ る_い/て||
                 ||||||

$ macomp -t jumanpp -t mecab-ipa-NE
柱で食べるジャパリまんは美味しい
jumanpp      |||食 べ る|ジ ャ パ リ|ま ん||美 味 し い|
mecab-ipa-NE |||食 べ る|ジ ャ|パ リ||||美 味 し い|

macomp-server

macomp-server

Open localhost:5000 and use the form, or use commands.

curl http://localhost:5000/api/v1/ma/食べたい
curl -X POST -d 'text=食べたい' http://localhost:5000/api/v1/ma
curl -X POST -d 'text=食べたい' -d 'callback=jsonp123' http://localhost:5000/api/v1/ma

See macomp-server -h for the detail.

Install

Macomp requires the following packages.

JUMAN and JUMAN++ are optional.

Golang

sudo apt-get install golang
echo 'export GOPATH=~/.go; export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc
soruce ~/.bashrc

MeCab

sudo apt-get install mecab libmecab-dev

You can also install from the source codes.

git clone git@github.com:taku910/mecab.git --depth 1
cd mecab/mecab
autoreconf -i
./configure --with-charset=utf8 --enable-utf8-only
make
sudo make install
sudo ldconfig

cd ../mecab-ipadic
./configure --with-charset=utf8
make
sudo make install

macomp

export CGO_LDFLAGS="`mecab-config --libs`"
export CGO_CFLAGS="-I`mecab-config --inc-dir`"
go get github.com/FairyDevicesRD/macomp/cmd/macomp
go get github.com/FairyDevicesRD/macomp/cmd/macomp-server

Configure

macomp --init
vi ~/.macomp.json
  • type is a mandatory field
  • path, aliases and options are not mandatory fields.
  • Set disable to true if you want to disable the setting
  • Be aware to use absolute path

License