Skip to content

Instantly share code, notes, and snippets.

@kanekomasahiro
Last active August 27, 2021 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanekomasahiro/9dc9a40eb638b24c206f43d7c8ee38af to your computer and use it in GitHub Desktop.
Save kanekomasahiro/9dc9a40eb638b24c206f43d7c8ee38af to your computer and use it in GitHub Desktop.
mecabを使おうとした時にmecabrcがないとエラー吐いた時の対策
# pip install unidic-lite
# /home/ユーザー名/.pyenv/versions/3.9.0/envs/evaluate_mlm/lib/python3.9/site-packages/unidic_lite/dicdir/ みたいな
# 箇所に辞書が作られるのでそこにパス通す.
import MeCab
tagger = MeCab.Tagger('-r /dev/null -d /home/ユーザ名/.pyenv/versions/3.9.0/envs/evaluate_mlm/lib/python3.9/site-packages/unidic_lite/dicdir -Owakati')
tagger.parse('これはペンです.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment