Package: mecab-python3
This is a Python wrapper for theMeCabmorphological analyzer for Japanese
text. It works with Python 3.6 and greater; if you need to use Python 2.7, use
v1.0.2.Note:If using MacOS Big Sur, you'll need to upgrade pip to version 20.3 or
higher to use wheels due to a pip issue.issueを英語で書く必要はありません。Note that Windows wheels require aMicrosoft Visual C++
Redistributable, so be sure to install that.Basic usage>>>importMeCab>>>wakati=MeCab.Tagger("-Owakati")>>>wakati.parse("pythonが大好きです").split()['python','が','大好き','です']>>>tagger=MeCab.Tagger()>>>print(tagger.parse("pythonが大好きです"))pythonpythonpythonpython名詞-普通名詞-一般がガガが助詞-格助詞大好きダイスキダイスキ大好き形状詞-一般ですデスデスです助動詞助動詞-デス終止形-一般EOSThe API formecab-python3closely follows the API for MeCab itself,
even when this makes it not very “Pythonic.”  Please consult theofficial MeCab
documentationfor more information.InstallationBinary wheels are available for MacOS X, Linux, and Windows (64bit) are
installed by default when you usepip:pipinstallmecab-python3These wheels include a copy of the MeCab library, but not a dictionary. In
order to use MeCab you'll need to install a dictionary.unidic-liteis a good
one to start with:pipinstallunidic-liteTo build from source using pip,pipinstall--no-binary:all:mecab-python3DictionariesIn order to use MeCab, you must install a dictionary. There are many different dictionaries available for MeCab. These UniDic packages, which include slight modifications for ease of use, are recommended:unidic: The latest full UniDic.unidic-lite: A slightly modified UniDic 2.1.2, chosen for its small size.The dictionaries below are not recommended due to being unmaintained for many years, but they are available for use with legacy applications.ipadicjumandicFor more details on the differences between dictionaries seehere.Common IssuesIf you get aRuntimeErrorwhen you try to run MeCab, here are some things to check:Windows RedistributableYou have to installthisto use this package on Windows.Installing a DictionaryRunpip install unidic-liteand confirm that works. If that fixes your
problem, you either don't have a dictionary installed, or you need to specify
your dictionary path like this:tagger = MeCab.Tagger('-r /dev/null -d /usr/local/lib/mecab/dic/mydic')Note: on Windows, usenulinstead of/dev/null. Alternately, if you have amecabrcyou can use the path after-r.Specifying a mecabrcIf you get this error:error message: [ifs] no such file or directory: /usr/local/etc/mecabrcYou need to specify amecabrcfile. It's OK to specify an empty file, it just
has to exist. You can specify amecabrcwith-r. This may be necessary on
Debian or Ubuntu, where themecabrcis in/etc/mecabrc.You can specify an emptymecabrclike this:tagger = MeCab.Tagger('-r/dev/null -d/home/hoge/mydic')Using Unsupported Output Modes like-OchasenChasen output is not a built-in feature of MeCab, you must specify it in yourdicrcormecabrc. Notably, Unidic does not include Chasen output format.
Please seethe MeCab documentation.Alternativesfugashiis a Cython wrapper for MeCab with a Pythonic interface, by the current maintainer of this librarySudachiPyis a modern tokenizer with an actively maintained dictionarypymecab-kois a wrapper of the Korean MeCab forkmecab-kobased on mecab-python3KoNLPyis a library for Korean NLP that includes a MeCab wrapperLicensingLike MeCab itself,mecab-python3is copyrighted free software by
Taku Kudotaku@chasen.organd Nippon Telegraph and Telephone Corporation,
and is distributed under a 3-clause BSD license (see the fileBSD).
Alternatively, it may be redistributed under the terms of the
GNU General Public License, version 2 (see the fileGPL) or the
GNU Lesser General Public License, version 2.1 (see the fileLGPL).