mecab-python3 1.0.10


pip install mecab-python3

  Latest version

Released: Oct 31, 2024

Project Links

Meta
Maintainer: Paul O'Leary McCann

Classifiers

Development Status
  • 6 - Mature

Programming Language
  • Python :: 3
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

Intended Audience
  • Developers
  • Science/Research

Natural Language
  • Japanese

Topic
  • Software Development :: Libraries :: Python Modules
  • Text Processing :: Linguistic

License
  • OSI Approved :: BSD License

This is a Python wrapper for the MeCab morphological analyzer for Japanese text. It currently works with Python 3.8 and greater.

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 a Microsoft Visual C++ Redistributable, so be sure to install that.

Basic usage

>>> import MeCab
>>> wakati = MeCab.Tagger("-Owakati")
>>> wakati.parse("pythonが大好きです").split()
['python', 'が', '大好き', 'です']

>>> tagger = MeCab.Tagger()
>>> print(tagger.parse("pythonが大好きです"))
python  python  python  python  名詞-普通名詞-一般
                        助詞-格助詞
大好き  ダイスキ        ダイスキ        大好き  形状詞-一般
です    デス    デス    です    助動詞  助動詞-デス     終止形-一般
EOS

The API for mecab-python3 closely follows the API for MeCab itself, even when this makes it not very “Pythonic.” Please consult the official MeCab documentation for more information.

Installation

Binary wheels are available for MacOS X, Linux, and Windows (64bit) are installed by default when you use pip:

pip install mecab-python3

These 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-lite is a good one to start with:

pip install unidic-lite

To build from source using pip,

pip install --no-binary :all: mecab-python3

Dictionaries

In 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.

For more details on the differences between dictionaries see here.

Common Issues

If you get a RuntimeError when you try to run MeCab, here are some things to check:

Windows Redistributable

You have to install this to use this package on Windows.

Installing a Dictionary

Run pip install unidic-lite and 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, use nul instead of /dev/null. Alternately, if you have a mecabrc you can use the path after -r.

Specifying a mecabrc

If you get this error:

error message: [ifs] no such file or directory: /usr/local/etc/mecabrc

You need to specify a mecabrc file. It's OK to specify an empty file, it just has to exist. You can specify a mecabrc with -r. This may be necessary on Debian or Ubuntu, where the mecabrc is in /etc/mecabrc.

You can specify an empty mecabrc like this:

tagger = MeCab.Tagger('-r/dev/null -d/home/hoge/mydic')

Using Unsupported Output Modes like -Ochasen

Chasen output is not a built-in feature of MeCab, you must specify it in your dicrc or mecabrc. Notably, Unidic does not include Chasen output format. Please see the MeCab documentation.

Alternatives

  • fugashi is a Cython wrapper for MeCab with a Pythonic interface, by the current maintainer of this library
  • SudachiPy is a modern tokenizer with an actively maintained dictionary
  • pymecab-ko is a wrapper of the Korean MeCab fork mecab-ko based on mecab-python3
  • KoNLPy is a library for Korean NLP that includes a MeCab wrapper

Licensing

Like MeCab itself, mecab-python3 is copyrighted free software by Taku Kudo taku@chasen.org and Nippon Telegraph and Telephone Corporation, and is distributed under a 3-clause BSD license (see the file BSD). Alternatively, it may be redistributed under the terms of the GNU General Public License, version 2 (see the file GPL) or the GNU Lesser General Public License, version 2.1 (see the file LGPL).

1.0.11.dev9 Nov 02, 2024
1.0.11.dev8 Nov 02, 2024
1.0.11.dev7 Nov 02, 2024
1.0.11.dev6 Nov 02, 2024
1.0.11.dev5 Nov 02, 2024
1.0.11.dev4 Nov 02, 2024
1.0.11.dev3 Nov 02, 2024
1.0.11.dev2 Nov 02, 2024
1.0.11.dev1 Nov 02, 2024
1.0.10 Oct 31, 2024
1.0.10.dev1 Oct 31, 2024
1.0.9 Apr 15, 2024
1.0.9.dev7 Apr 15, 2024
1.0.9.dev6 Apr 15, 2024
1.0.9.dev5 Mar 09, 2024
1.0.9.dev4 Dec 21, 2023
1.0.9.dev3 Dec 14, 2023
1.0.9.dev2 Dec 14, 2023
1.0.9.dev1 Dec 10, 2023
1.0.8 Sep 22, 2023
1.0.8a1 Sep 15, 2023
1.0.7 Sep 14, 2023
1.0.7.dev3 Sep 14, 2023
1.0.7.dev2 Sep 13, 2023
1.0.7.dev1 Sep 13, 2023
1.0.6 Dec 06, 2022
1.0.6a1 Dec 06, 2022
1.0.5 Feb 16, 2022
1.0.5a2 Feb 16, 2022
1.0.5a1 Jan 28, 2022
1.0.4 Jun 23, 2021
1.0.4a2 May 19, 2021
1.0.4a1 May 18, 2021
1.0.3 Nov 09, 2020
1.0.3a2 Nov 09, 2020
1.0.3a1 Nov 09, 2020
1.0.2 Oct 22, 2020
1.0.2a3 Oct 20, 2020
1.0.2a2 Oct 20, 2020
1.0.2a1 Aug 13, 2020
1.0.1 Jul 09, 2020
1.0.0 Jun 29, 2020
1.0.0a1 Apr 27, 2020
0.996.6rc4 Apr 23, 2020
0.996.6rc3 Apr 23, 2020
0.996.6rc2 Apr 04, 2020
0.996.6rc1 Mar 15, 2020
0.996.5 Mar 15, 2020
0.996.3 Dec 26, 2019
0.996.2 Apr 22, 2019
0.996.1 Nov 13, 2018
0.7 Sep 16, 2014
0.6 Sep 11, 2014
0.5 Sep 11, 2014

Wheel compatibility matrix

Platform CPython 3.6 CPython 3.7 CPython 3.8 CPython 3.9 CPython 3.10 CPython 3.11 CPython 3.12 CPython 3.13
macosx_10_13_universal2
macosx_10_13_x86_64
macosx_10_9_universal2
macosx_10_9_x86_64
macosx_11_0_arm64
manylinux2014_aarch64
manylinux2014_x86_64
manylinux_2_17_aarch64
manylinux_2_17_x86_64
win_amd64

Files in release

mecab_python3-1.0.10-cp310-cp310-macosx_10_9_universal2.whl (512.0KiB)
mecab_python3-1.0.10-cp310-cp310-macosx_10_9_x86_64.whl (476.4KiB)
mecab_python3-1.0.10-cp310-cp310-macosx_11_0_arm64.whl (472.5KiB)
mecab_python3-1.0.10-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (547.1KiB)
mecab_python3-1.0.10-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (568.1KiB)
mecab_python3-1.0.10-cp310-cp310-win_amd64.whl (490.7KiB)
mecab_python3-1.0.10-cp311-cp311-macosx_10_9_universal2.whl (512.0KiB)
mecab_python3-1.0.10-cp311-cp311-macosx_10_9_x86_64.whl (476.4KiB)
mecab_python3-1.0.10-cp311-cp311-macosx_11_0_arm64.whl (472.5KiB)
mecab_python3-1.0.10-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (554.2KiB)
mecab_python3-1.0.10-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (575.0KiB)
mecab_python3-1.0.10-cp311-cp311-win_amd64.whl (490.7KiB)
mecab_python3-1.0.10-cp312-cp312-macosx_10_13_universal2.whl (511.6KiB)
mecab_python3-1.0.10-cp312-cp312-macosx_10_13_x86_64.whl (476.2KiB)
mecab_python3-1.0.10-cp312-cp312-macosx_11_0_arm64.whl (472.9KiB)
mecab_python3-1.0.10-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (555.7KiB)
mecab_python3-1.0.10-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (577.3KiB)
mecab_python3-1.0.10-cp312-cp312-win_amd64.whl (491.4KiB)
mecab_python3-1.0.10-cp313-cp313-macosx_10_13_universal2.whl (511.6KiB)
mecab_python3-1.0.10-cp313-cp313-macosx_10_13_x86_64.whl (476.2KiB)
mecab_python3-1.0.10-cp313-cp313-macosx_11_0_arm64.whl (472.9KiB)
mecab_python3-1.0.10-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (555.5KiB)
mecab_python3-1.0.10-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (577.2KiB)
mecab_python3-1.0.10-cp313-cp313-win_amd64.whl (491.4KiB)
mecab_python3-1.0.10-cp36-cp36m-macosx_10_9_x86_64.whl (475.9KiB)
mecab_python3-1.0.10-cp37-cp37m-macosx_10_9_x86_64.whl (476.2KiB)
mecab_python3-1.0.10-cp38-cp38-macosx_10_9_universal2.whl (512.0KiB)
mecab_python3-1.0.10-cp38-cp38-macosx_10_9_x86_64.whl (476.4KiB)
mecab_python3-1.0.10-cp38-cp38-macosx_11_0_arm64.whl (472.5KiB)
mecab_python3-1.0.10-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (542.1KiB)
mecab_python3-1.0.10-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (564.3KiB)
mecab_python3-1.0.10-cp38-cp38-win_amd64.whl (491.0KiB)
mecab_python3-1.0.10-cp39-cp39-macosx_10_9_universal2.whl (511.9KiB)
mecab_python3-1.0.10-cp39-cp39-macosx_10_9_x86_64.whl (476.4KiB)
mecab_python3-1.0.10-cp39-cp39-macosx_11_0_arm64.whl (472.5KiB)
mecab_python3-1.0.10-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (546.8KiB)
mecab_python3-1.0.10-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (568.0KiB)
mecab_python3-1.0.10-cp39-cp39-win_amd64.whl (490.8KiB)
mecab_python3-1.0.10.tar.gz (76.8KiB)
Extras:
Dependencies: