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.6 and greater; if you need to use Python 2.7, use v1.0.2.

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 an internal (statically linked) copy of the MeCab library, but not 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

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 libray
  • SudachiPy is a modern tokenizer with a maintained dictionary, though it's slower than MeCab
  • 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).

Project details


Release history Release notifications | RSS feed

This version

1.0.3

Download files

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

Source Distribution

mecab-python3-1.0.3.tar.gz (77.1 kB view details)

Uploaded Source

Built Distributions

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

mecab_python3-1.0.3-cp39-cp39-win_amd64.whl (509.8 kB view details)

Uploaded CPython 3.9Windows x86-64

mecab_python3-1.0.3-cp39-cp39-manylinux1_x86_64.whl (488.5 kB view details)

Uploaded CPython 3.9

mecab_python3-1.0.3-cp39-cp39-macosx_10_14_x86_64.whl (280.5 kB view details)

Uploaded CPython 3.9macOS 10.14+ x86-64

mecab_python3-1.0.3-cp38-cp38-win_amd64.whl (509.9 kB view details)

Uploaded CPython 3.8Windows x86-64

mecab_python3-1.0.3-cp38-cp38-manylinux1_x86_64.whl (490.1 kB view details)

Uploaded CPython 3.8

mecab_python3-1.0.3-cp38-cp38-macosx_10_14_x86_64.whl (280.6 kB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

mecab_python3-1.0.3-cp37-cp37m-win_amd64.whl (509.6 kB view details)

Uploaded CPython 3.7mWindows x86-64

mecab_python3-1.0.3-cp37-cp37m-manylinux1_x86_64.whl (487.9 kB view details)

Uploaded CPython 3.7m

mecab_python3-1.0.3-cp37-cp37m-macosx_10_14_x86_64.whl (280.5 kB view details)

Uploaded CPython 3.7mmacOS 10.14+ x86-64

mecab_python3-1.0.3-cp36-cp36m-win_amd64.whl (509.6 kB view details)

Uploaded CPython 3.6mWindows x86-64

mecab_python3-1.0.3-cp36-cp36m-manylinux1_x86_64.whl (487.8 kB view details)

Uploaded CPython 3.6m

mecab_python3-1.0.3-cp36-cp36m-macosx_10_14_x86_64.whl (280.5 kB view details)

Uploaded CPython 3.6mmacOS 10.14+ x86-64

mecab_python3-1.0.3-cp35-cp35m-win_amd64.whl (509.6 kB view details)

Uploaded CPython 3.5mWindows x86-64

mecab_python3-1.0.3-cp35-cp35m-manylinux1_x86_64.whl (487.6 kB view details)

Uploaded CPython 3.5m

mecab_python3-1.0.3-cp35-cp35m-macosx_10_14_x86_64.whl (280.5 kB view details)

Uploaded CPython 3.5mmacOS 10.14+ x86-64

File details

Details for the file mecab-python3-1.0.3.tar.gz.

File metadata

  • Download URL: mecab-python3-1.0.3.tar.gz
  • Upload date:
  • Size: 77.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for mecab-python3-1.0.3.tar.gz
Algorithm Hash digest
SHA256 62abe28a1155398325372291483608427bc82681fef80e7d132904415f9fd42e
MD5 756ba0764c8736835126630d5b01c0b9
BLAKE2b-256 6c71fc591b2411a4f04c674beafd67c5d7b22873a50f4e5ebe9cfe3dc3d46e3c

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 509.8 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for mecab_python3-1.0.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ecfa3ce98aef5c79f2e0721d329493588a2cdc1e21cc0147c912b291d6b047b6
MD5 07cdbdd712ac8b6492cf606d5f7ef3d5
BLAKE2b-256 8330367be67f1a03e4cddd69aa7886cac8f67ba301d0f9e6e60d9608e1baa4e0

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 488.5 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for mecab_python3-1.0.3-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 900de8f3c0736875d1bd64e1f1c381bc697afde477bb501c93198b5e0efbe934
MD5 212052abd3f072d466bd22ef72ab1e37
BLAKE2b-256 c976295117470519836700c1c57837959d5ea65d63017b01a7b1de547a79478b

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 280.5 kB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for mecab_python3-1.0.3-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 cba161eefe02d370cebb20f6a9aaea76c9d93d9372d993014f83865f26e0994a
MD5 0f98ec2b6d424d2d4711ba4a702df282
BLAKE2b-256 417d03ebd2fc4c8c3ebbc0fa060bc3ccd55341ab1f0d099388dee310076eed6c

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 509.9 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for mecab_python3-1.0.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 4927baddd924079e89bf3d366dfd3fcc47c84e05f9a50a3832d43334250b1253
MD5 e7ccbf8e27a74a7dabab721e5d6498e0
BLAKE2b-256 8f1dced51686a7ed472813347e104a71c0a9019474e6c0001a55b38e642638f7

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 490.1 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for mecab_python3-1.0.3-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 7202de44c7a077b35fd0e820746415954fe2d61735df9797455023d4c0eb1bc0
MD5 d1f306c8295f4861bfefea875d235007
BLAKE2b-256 1119a10fe1938c86bbbadff7a439b9ef3bd18ea04c7a84879f9998a12fd217be

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 280.6 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.6

File hashes

Hashes for mecab_python3-1.0.3-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 204aa45f342e7c32a346266ee149a1ce29d51e2c2458841ffc67b4589e96ec6b
MD5 f70baafbeed9ea7c3553db7f152855cf
BLAKE2b-256 94dbc5e43d0e390a59ce2e4ea0fc8dc5092c1bcfea2802996e34ff62995c0c6a

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 509.6 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for mecab_python3-1.0.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 3dad694911a1f6da77cc4be4317e3febfeb44d34674a2365f4d507fad58bd0c5
MD5 cbac088d72002a5dd65ff7349399284c
BLAKE2b-256 24193e9cecb5a5c1affc91681f90c37d93de87eefb6db61a22cb6227f97fe5cc

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 487.9 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for mecab_python3-1.0.3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5c8f923a9c4496658dc44b46e012bad9f95ed6f8486ad8b9417d2835649a1265
MD5 32570fa680f4e735a7d7e7abd9a98038
BLAKE2b-256 c17220f8f60b858556fdff6c0376b480c230e594621fff8be780603ac9c47f6a

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 280.5 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.7.9

File hashes

Hashes for mecab_python3-1.0.3-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 4d9bde34482ce1aa57c0309ce77c0c35e1d058cd5b779e8ea4e0cd223f3e846d
MD5 1eaa59ad669f6c4a0c180d70b20aab4c
BLAKE2b-256 38ddb9e3185507730e8d6552bd3616601ed00045861f6c86da1c33cdb0505d74

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 509.6 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.8

File hashes

Hashes for mecab_python3-1.0.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 3bfd9ddba93f81308eb82c8199faf210882d5202000f8f6b88e35b840094e6cb
MD5 aa802bfb26f24f38c0c2654238c346a6
BLAKE2b-256 02bb2bcf20767c57867e496d524d4e8fae97f2361136a82fae6ccc4dcd51230d

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 487.8 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for mecab_python3-1.0.3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 99dae91a1bc574f746fecf68f2aaefde068ce4e67828f89e45e6d69375de20f8
MD5 eb68df69603ee3990ec299f40bc2c616
BLAKE2b-256 b4f0b57bfb29abd6b898d7137f4a276a338d2565f28a2098d60714388d119f3e

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 280.5 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.12

File hashes

Hashes for mecab_python3-1.0.3-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 fd079d7dba4c7d48491e2db5b4aaeb98ca5a21d9b4713857ac6eed8e761286ed
MD5 e4366e0cf636a3df00706fd5e81e8751
BLAKE2b-256 8df47910cf628367d3341816c693447a526e07cab09d36a1986ff38fe3cce7fa

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 509.6 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.4

File hashes

Hashes for mecab_python3-1.0.3-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 d0c2bc63e2684fa2be8bb39ad0c80e852c2819b450a4f573c5f6dc7d8892ba43
MD5 dde84af6e54fc14550eb057a7a9d3385
BLAKE2b-256 12dcab098eadd2a324df6eff1eba1f6495fc3690b03271a4cdc33da42510cfe9

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 487.6 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for mecab_python3-1.0.3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 aef526312eb990d0843685b705604424573263d21374c29f381b04a75a42b91b
MD5 720d12c50cf8c028dd93d782479e444d
BLAKE2b-256 bb60b52449154cceac30138e3d07f7e313bb451b4e2c1b0ff17eb1556d971006

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.3-cp35-cp35m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mecab_python3-1.0.3-cp35-cp35m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 280.5 kB
  • Tags: CPython 3.5m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.6.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.5.10

File hashes

Hashes for mecab_python3-1.0.3-cp35-cp35m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 02792fe78a8ff678e5ead2cfb8ba242d44793c43e2ec469e9b6f8a9ef32dd52f
MD5 d489a15ac9eb4ab55a35b40d1688dc7b
BLAKE2b-256 ce172155885d6cc2101135462ac5d462c2d23d37c5eebc944d6abcf01a7fed8e

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