First, initialize ~/.macomp.json
to run the following command.
macomp --init
Modify it if you need.
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
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.
Macomp requires the following packages.
JUMAN and JUMAN++ are optional.
sudo apt-get install golang
echo 'export GOPATH=~/.go; export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc
soruce ~/.bashrc
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
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
macomp --init
vi ~/.macomp.json
type
is a mandatory fieldpath
,aliases
andoptions
are not mandatory fields.- Set
disable
totrue
if you want to disable the setting - Be aware to use absolute path