{"id":430,"date":"2014-08-05T23:02:01","date_gmt":"2014-08-05T14:02:01","guid":{"rendered":"http:\/\/blog.ymyzk.com\/?p=430"},"modified":"2014-12-03T09:57:07","modified_gmt":"2014-12-03T00:57:07","slug":"debian-mecab-python","status":"publish","type":"post","link":"https:\/\/blog.ymyzk.com\/2014\/08\/debian-mecab-python\/","title":{"rendered":"Debian \u306b MaCab \u3068 mecab-python \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b"},"content":{"rendered":"

Debian \u3067 MeCab \u3068 mecab-python \u3092\u5229\u7528\u3059\u308b\u306b\u306f, \u5358\u7d14\u306b apt \u3084 pip \u3060\u3051\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u305a, \u3044\u304f\u3064\u304b\u6ce8\u610f\u3059\u308b\u70b9\u304c\u3042\u308a\u307e\u3059.<\/p>\n

\"aptitude<\/p>\n

<\/p>\n

MeCab \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n

\u307e\u305a MeCab \u672c\u4f53\u3092 apt \u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059.<\/p>\n

\r\nsudo aptitude install mecab\r\n<\/pre>\n

MeCab \u7528\u8f9e\u66f8\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n

MeCab \u7528\u306e\u8f9e\u66f8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059. EUC-JP \u306e\u3082\u306e\u3068 UTF-8 \u306e\u3082\u306e\u304c\u5b58\u5728\u3059\u308b\u306e\u3067\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3059.<\/p>\n\n\n\n\n\n\n
\u8f9e\u66f8<\/th>\nUTF-8<\/th>\nEUC-JP<\/th>\n<\/tr>\n
IPA<\/td>\nmecab-ipadic-utf8<\/td>\nmecab-ipadic<\/td>\n<\/tr>\n
Juman<\/td>\nmecab-jumandic-utf8<\/td>\nmecab-jumandic<\/td>\n<\/tr>\n
NAIST<\/td>\nmecab-naist-jdic<\/td>\nmecab-naist-jdic-eucjp<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u3053\u3053\u3067\u306f IPA \u306e UTF-8 \u3092\u7528\u3044\u307e\u3059.<\/p>\n

\r\nsudo aptitude install mecab-ipadic-utf8\r\n<\/pre>\n

\u8907\u6570\u306e\u8f9e\u66f8\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u5834\u5408\u306f, update-alternatives \u3067\u9078\u629e\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059.<\/p>\n

\r\nsudo update-alternatives --config mecab-dictionary\r\n<\/pre>\n

mecab-python \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb (\u30b7\u30b9\u30c6\u30e0)<\/h2>\n

\u30b7\u30b9\u30c6\u30e0\u306b\u76f4\u63a5 mecab-python \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5834\u5408\u306f, apt \u304b\u3089\u76f4\u63a5\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3067\u304d\u307e\u3059.<\/p>\n

\r\nsudo aptitude install python-mecab\r\n<\/pre>\n

mecab-python \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb (virtualenv)<\/h2>\n

mecab-python \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a mecab-config \u3092\u5229\u7528\u3059\u308b\u305f\u3081\u306b\u4ee5\u4e0b\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059.<\/p>\n

\r\nsudo aptitude install libmecab-dev\r\n<\/pre>\n

virtualenv \u3067\u4f5c\u6210\u3057\u305f\u74b0\u5883\u306b mecab-python \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5834\u5408\u306f\u5225\u9014\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059.\u00a0mecab-python \u306f PyPI \u306b\u767b\u9332\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081, \u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u3092\u76f4\u63a5\u53d6\u5f97\u3057\u307e\u3059.<\/p>\n

\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u306f Google Code<\/a> \u3067\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059.<\/p>\n

MeCab \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3068\u540c\u3058\u30d0\u30fc\u30b8\u30e7\u30f3\u306e mecab-python \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059.<\/p>\n

\r\n# Debian 7 wheezy\r\npip install https:\/\/mecab.googlecode.com\/files\/mecab-python-0.99.tar.gz\r\n# Debian 8 jessie (2014\/8\/5 \u6642\u70b9)\r\npip install https:\/\/mecab.googlecode.com\/files\/mecab-python-0.996.tar.gz\r\n<\/pre>\n

\u30c6\u30b9\u30c8<\/h2>\n

Python \u3092\u8d77\u52d5\u3057, import MeCab \u304c\u5b9f\u884c\u3067\u304d\u308c\u3070\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u51fa\u6765\u3066\u3044\u307e\u3059.<\/p>\n

mecab-python \u306b\u6587\u5b57\u5217\u3092\u6e21\u3059\u6642\u306f UTF-8 \u3084 EUC-JP \u306a\u3069\u306b\u9069\u5207\u306b decode \u3057, mecab-python \u304b\u3089\u6587\u5b57\u5217\u3092\u53d7\u3051\u53d6\u308b\u6642\u306f UTF-8 \u3084 EUC-JP \u304b\u3089\u9069\u5207\u306b encode \u3057\u307e\u3059.<\/p>\n","protected":false},"excerpt":{"rendered":"

Debian \u3067 MeCab \u3068 mecab-python \u3092\u5229\u7528\u3059\u308b\u306b\u306f, \u5358\u7d14\u306b apt \u3084 pip \u3060\u3051\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u305a, \u3044\u304f\u3064\u304b\u6ce8\u610f\u3059\u308b\u70b9\u304c\u3042\u308a\u307e\u3059.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,3],"tags":[16,58,15],"_links":{"self":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/430"}],"collection":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/comments?post=430"}],"version-history":[{"count":11,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/430\/revisions"}],"predecessor-version":[{"id":631,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/430\/revisions\/631"}],"wp:attachment":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/media?parent=430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/categories?post=430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/tags?post=430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}