Skip to main content

Python wrapper for the MeCab morphological analyzer for Japanese

Project description

This is a Python wrapper for the MeCab morphological analyzer for Japanese text. It works with Python 3.5 and greater, as well as Python 2.7. (Note: Python 3.5 is not supported on OSX, see this 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', 'が', '大好き', 'です']

>>> chasen = MeCab.Tagger("-Ochasen")
>>> print(chasen.parse("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 MeCab documentation for more information.

Installation

Binary wheels are available for MacOS X and Linux, and are installed by default when you use pip:

pip install mecab-python3

These wheels include an internal (statically linked) copy of the MeCab library, and a copy of the mecab-ipadic dictionary (using UTF-8 text encoding), which is automatically used by default. If you wish to use a different dictionary, you will need to install it yourself, write a mecabrc file directing MeCab to use it, and set the environment variable MECABRC to point to this file.

To build from source using pip,

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

Alternatively, you can use pip to download the source, then build it by hand:

pip download --no-binary :all: mecab-python3
tar zxf mecab-python3-{version}.tar.gz
cd mecab-python3-{version}
python3 setup.py build
# install as you like

When the module is built from source, it requires the system to provide the MeCab library and at least one dictionary. You must have SWIG, the MeCab library and headers, and a dictionary installed before running pip install or setup.py build. For instance, on Debian-based Linux,

sudo apt-get install swig libmecab-dev mecab-ipadic-utf8

Building wheels with a bundled library and dictionary is only supported in a sanitized CI environment. Consult the scripts in the scripts subdirectory of the source tree to see how it’s done.

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

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mecab_python3-0.996.6rc4-cp38-cp38-win_amd64.whl (508.1 kB view details)

Uploaded CPython 3.8Windows x86-64

mecab_python3-0.996.6rc4-cp38-cp38-macosx_10_9_x86_64.whl (301.3 kB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

mecab_python3-0.996.6rc4-cp37-cp37m-win_amd64.whl (507.9 kB view details)

Uploaded CPython 3.7mWindows x86-64

mecab_python3-0.996.6rc4-cp37-cp37m-macosx_10_9_x86_64.whl (301.1 kB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

mecab_python3-0.996.6rc4-cp36-cp36m-win_amd64.whl (507.9 kB view details)

Uploaded CPython 3.6mWindows x86-64

mecab_python3-0.996.6rc4-cp36-cp36m-macosx_10_9_x86_64.whl (301.1 kB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

mecab_python3-0.996.6rc4-cp35-cp35m-win_amd64.whl (507.9 kB view details)

Uploaded CPython 3.5mWindows x86-64

mecab_python3-0.996.6rc4-cp27-cp27m-macosx_10_9_x86_64.whl (300.3 kB view details)

Uploaded CPython 2.7mmacOS 10.9+ x86-64

File details

Details for the file mecab_python3-0.996.6rc4-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: mecab_python3-0.996.6rc4-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 508.1 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for mecab_python3-0.996.6rc4-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 162a8edf31a38cc79d02a22b49aff06557a9f1112b707a558d66a251f1c26f4d
MD5 bda86917a631a23091612de8cc892410
BLAKE2b-256 d3f7e6f714f555fe2c2e856f9ea472a289d9f1b13c2846b50e2121107449432b

See more details on using hashes here.

File details

Details for the file mecab_python3-0.996.6rc4-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: mecab_python3-0.996.6rc4-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 301.3 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for mecab_python3-0.996.6rc4-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f2832908ee282128bcb29f579cf2cc886462e65040b8d8cf88a63d64fa5cce37
MD5 bc4ea937a537e49209e71b567d30a8b9
BLAKE2b-256 fb56ada89c906fe9cd94f09598f3b26ea25ba4f001b442cc00dd37fc6edc77fc

See more details on using hashes here.

File details

Details for the file mecab_python3-0.996.6rc4-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: mecab_python3-0.996.6rc4-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 507.9 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for mecab_python3-0.996.6rc4-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 3319c71583cb7a3a005326314a5a14d7c64fc5983e9c8693138d2b29c2a7e8a0
MD5 5fca45a1122eab6b2415a98bdc033906
BLAKE2b-256 cc01e3aa9f674e0d2231dbf0da6f0f850ca65a9f4bc375b840d91c2ee8b3d2b2

See more details on using hashes here.

File details

Details for the file mecab_python3-0.996.6rc4-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: mecab_python3-0.996.6rc4-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 301.1 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for mecab_python3-0.996.6rc4-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6789e2ba1c482180cac686beef4aa38a4c85b2a9f407162082ff2c3068f9b0e6
MD5 25d4f3633ae8df23400b00fdf150e7c1
BLAKE2b-256 1b262eef343309727b7bac01ed6966cbe33b387e9dd19c886e46788ba14f3e61

See more details on using hashes here.

File details

Details for the file mecab_python3-0.996.6rc4-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: mecab_python3-0.996.6rc4-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 507.9 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for mecab_python3-0.996.6rc4-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 b9891eca479a3cd56d84bee1d725f30913f87646634f7fd6aec4eef7d57b5164
MD5 93b397ea67680470d06f520a4a93f1ee
BLAKE2b-256 365271dd785c0602e819fd3cf685af2b17005180bc52ff4ff5405a51f0d4eced

See more details on using hashes here.

File details

Details for the file mecab_python3-0.996.6rc4-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: mecab_python3-0.996.6rc4-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 301.1 kB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for mecab_python3-0.996.6rc4-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8904ad31d397bd70e45546279045ebbcea809236b57a0c1813821b670a3b41e7
MD5 8cb1811720689d9f613b89f25069db99
BLAKE2b-256 0ad87ef6d62767fac8371a2519c9aff60c879cd1f470f1d92d4b551bc3772da3

See more details on using hashes here.

File details

Details for the file mecab_python3-0.996.6rc4-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: mecab_python3-0.996.6rc4-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 507.9 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for mecab_python3-0.996.6rc4-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 2c6ee62e34675e838f967d016fa36660e5ea6e1d6d3e32bcea3b643384c721e1
MD5 a0d9a8fe603b85b2d5eccf554d6f7a66
BLAKE2b-256 2eaef6fcef4f956b8673e063853be16ffac765b7766fe99058c09b93b46dcc10

See more details on using hashes here.

File details

Details for the file mecab_python3-0.996.6rc4-cp27-cp27m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: mecab_python3-0.996.6rc4-cp27-cp27m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 300.3 kB
  • Tags: CPython 2.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

File hashes

Hashes for mecab_python3-0.996.6rc4-cp27-cp27m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 bde07e9d5ba24ffef0428d5c8e838ad30e592a1e3684f2ea2859dae3bc86ec2e
MD5 1aa4a506f0b2b52f851e51f96ef1fe61
BLAKE2b-256 95d7e2cf54f98dded9fda334f549ad054172b37f8b99a18ef99823ae6b1aab3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page