2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

MeCabでUniDicの出力をカスタマイズ

Posted at

ちゃお…†

MeCabでUniDicをIPAdicみたいにCSVフォーマットで出力したくて --node-format オプションとかで指定したのになぜか無視されてるっていうのが地味に困る問題。。。

検索すると同様の問題にぶつかってる人がいて解決法がありました。

[小ネタ] mecab + unidic で出力フォーマットを整形する方法 | NaviPlus Engineers' Blog

-Oオブションにブランクを指定する

と解決します。

なので、下のコマンドでMeCab実行すればUniDicをIPAdicと同じくCSVフォーマットで出力できます。

$ mecab -d `mecab-config --dicdir`/unidic -O '' -F '%m\t%H\n'

IPAdicの-Oyomiみたいに読みだけ取得したい場合はこちら。

$ mecab -d `mecab-config --dicdir`/unidic -O "" -F "%f[6]" -U "%m" -E "\n"
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?