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.

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

Project details


Release history Release notifications | RSS feed

This version

1.0.6

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.6.tar.gz (77.7 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.6-cp311-cp311-win_amd64.whl (501.3 kB view details)

Uploaded CPython 3.11Windows x86-64

mecab_python3-1.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (588.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

mecab_python3-1.0.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (567.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

mecab_python3-1.0.6-cp311-cp311-macosx_10_9_universal2.whl (314.5 kB view details)

Uploaded CPython 3.11macOS 10.9+ universal2 (ARM64, x86-64)

mecab_python3-1.0.6-cp310-cp310-win_amd64.whl (501.3 kB view details)

Uploaded CPython 3.10Windows x86-64

mecab_python3-1.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (581.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

mecab_python3-1.0.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (560.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

mecab_python3-1.0.6-cp310-cp310-macosx_10_15_x86_64.whl (274.3 kB view details)

Uploaded CPython 3.10macOS 10.15+ x86-64

mecab_python3-1.0.6-cp39-cp39-win_amd64.whl (501.4 kB view details)

Uploaded CPython 3.9Windows x86-64

mecab_python3-1.0.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (581.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

mecab_python3-1.0.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (559.9 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

mecab_python3-1.0.6-cp39-cp39-macosx_10_15_x86_64.whl (274.3 kB view details)

Uploaded CPython 3.9macOS 10.15+ x86-64

mecab_python3-1.0.6-cp38-cp38-win_amd64.whl (501.6 kB view details)

Uploaded CPython 3.8Windows x86-64

mecab_python3-1.0.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (577.8 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

mecab_python3-1.0.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (555.0 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

mecab_python3-1.0.6-cp38-cp38-macosx_10_15_x86_64.whl (274.4 kB view details)

Uploaded CPython 3.8macOS 10.15+ x86-64

mecab_python3-1.0.6-cp37-cp37m-win_amd64.whl (501.5 kB view details)

Uploaded CPython 3.7mWindows x86-64

mecab_python3-1.0.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (575.1 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

mecab_python3-1.0.6-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (551.8 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ ARM64

mecab_python3-1.0.6-cp37-cp37m-macosx_10_15_x86_64.whl (274.3 kB view details)

Uploaded CPython 3.7mmacOS 10.15+ x86-64

mecab_python3-1.0.6-cp36-cp36m-win_amd64.whl (511.5 kB view details)

Uploaded CPython 3.6mWindows x86-64

mecab_python3-1.0.6-cp36-cp36m-macosx_10_14_x86_64.whl (274.1 kB view details)

Uploaded CPython 3.6mmacOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: mecab-python3-1.0.6.tar.gz
  • Upload date:
  • Size: 77.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for mecab-python3-1.0.6.tar.gz
Algorithm Hash digest
SHA256 16f38ace484020bd3446a10054829678c1e7b97f1740b58b00a31d595cff025e
MD5 5c6fcaa9e8d0a008082409fe629daece
BLAKE2b-256 94026a7146d3a4b4a47fb4c67346e25624cbcd72cefbe6d08107b1449e262abc

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 e28997040b5ea9df3cf8969c5d28e7ba730ef4f924badac0548cd14383e56c66
MD5 03c4d1fd53ceec2a484f5a60d841805c
BLAKE2b-256 5b4301b582e5dae0c6fde50660f54d009ff9ae466ee27a15aaf1ff6dc1791e94

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a455f0f1830392548366aae56819a22fa0f5786c39c4cf6cf84fe438a5fc7cbc
MD5 6277d794ac6658d16df976043e047e65
BLAKE2b-256 33c97bf4d6b7ab576e441915e96c04016030c71112039ee93ba0218f74e469fd

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3eb8655d4eb7e17dbe7f409b8dda327539de9ee8cf06ebe338aa595bb597b53d
MD5 52ce82ebb2abc49a9134b3aab4f9db95
BLAKE2b-256 2c45e86f390ead54ea132ab6d94e5fd4d04332cd08218f4e5a17dcf2a8063d47

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 023cfd4efa26fc61563ee185e8ac3d5fcdffcaba01931bbae34aa0ec06814875
MD5 808684e3449c3c9133228f4af1358dd6
BLAKE2b-256 27fa666da3edaf222a0f038f8b49c67d9edc3000b3185ade177d1d225f66f22d

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 fd10ba05f94dea7fe5e281336b7a4d07f79062c25139077d935833d0db303450
MD5 3e8f576888c378391098a83747c02783
BLAKE2b-256 4213f6da78d5832d7333e761406ccf731a99c6ab19be97ef3a6e636a91bfa53c

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 30177272efa6ba26909b540e3816659c9f93ee49a5cc2b8ea47c17eff05c686b
MD5 533b72508d61bfa79bd33bdc4745ce9c
BLAKE2b-256 941a86a50a8b295d50d26567269fdc5c368c76d62e8363bc23ace0aa64aac5d2

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6c99ec5f5581e4b56c8b68b4eeac4c6b59c6de12e66a2cfe4b1c6f8e87d38bd7
MD5 7b143e90e1ee40d5ffa920a8e8bd3c1a
BLAKE2b-256 8fee7f6fc3e83920ee639b738607581a4ac32bd05461fcd6f1637eece9e3d2b9

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 0fb9f5a06f9cd9c5724608956128b91f5330248a78e9de322a0abd5beaba24a3
MD5 4f0ca223b4dd1446dededc3f5ce9c2ba
BLAKE2b-256 a49c9e5f7068e50419e6d02d164343c7dc52c0ad1d5217be57fdc9164d18e2e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9c3eeb4adf864a74ced9a1c5443b174f1e851323143ca6f24391fb6db8d44110
MD5 a4e303b811b6e7b19ce6cb005079ae14
BLAKE2b-256 65c26d282f4be6f6020ab8569359967b8c9c1e79ce88bea80233d273ae5a1da8

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e00f0c329c7708b6cf5e5b2b1772535de3d6d69f99e6105a1acf40b94c62afe5
MD5 b2a7283c8f5fccd682b1d562929f0b2c
BLAKE2b-256 d1deb92d65593808dcc122adc246d679319c65109bb9fcf6f543f197f4943e7f

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b8c995629aeb6bdddf37eee1c4049549ff1993e3888e28eb6cc59c8dce79de41
MD5 5c4790477662841efe4811a0174b2864
BLAKE2b-256 816f7a1ab395bc014c8e77dec941e3d8ad6dc366c9faa8f5fff0773a5b4dab9f

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 b2a3b6243d709ccf6672d54c9c17cb6281a17737626caaafb0219944835d6b9c
MD5 d021aa0e93db91b8c0052e805ddda84e
BLAKE2b-256 ecc994e235583e2f2aae575ad4df261bdd4ec30daf5f54292871e80ad6de859b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d1061bcd3d5567d6522e8794773689e6f9dedadcd3d3b1652893142f6334ec95
MD5 4752906b011a372f9c23695a1b3edab0
BLAKE2b-256 4bac03cc43b354c53d422ad9da9eae07b3fd5dc32bfff2715b4cbeddad7cfcb3

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 849aa7cfb828f0fb65340666fb2ae281855f5319699291121e116f43f478401c
MD5 4aee8caf50ad17ff7c09e4d2434a273d
BLAKE2b-256 7f15abc85c7cb981080095107dc4c8269ac6e16268d5a5c06ab0fceccd46a3b0

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fde76ebc2fcf4f375b520a706af316f88be304302f5e5d36105992a1ecd3ea1b
MD5 306ff8aebdb05f1f22c1430ae96c2d12
BLAKE2b-256 c28d35b75719c8f0dce8d536d08a5418bebfe03ef9bc3a6a51531f866666cee3

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 ef43e4ab82396d1a59f4d8e2237c4136e09391e8e8ba623af4b52e6b52377fdd
MD5 867792ea3175fc8e2008cff932911d53
BLAKE2b-256 85a58c08887697a8f2811f9760160e7d7f320a37708f15f31a223fb49fb1e156

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 68334cbc6e0442ccd57770137ece585de9a512f01405bd2ad074fd28578180f8
MD5 5ebe9bffde4d50f8581dcac8bf5d914e
BLAKE2b-256 a401ad6e367102d7109a55779d7bc1097c67741a8abbd020a126094765fc43b9

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b56692cef89cd8ad0179bd2f989e4b3209686eb59124e0191167d9a3e64cd1a0
MD5 ee570a28dca72d246969514bc45b5228
BLAKE2b-256 020f46864a0def2c8477ceb37efe4c1bac51e92932c63773711a6e470fe1faad

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e049805f8342020b559357f4ea2b69b7d4faf8681c979ffd868d4d25d3a89021
MD5 04bd6f298c3c00b420a0ebca75628901
BLAKE2b-256 2f580163b836543270a470cf959f3d04eb30d91b622ead951cd8bad3a4055f5b

See more details on using hashes here.

File details

Details for the file mecab_python3-1.0.6-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for mecab_python3-1.0.6-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 8f0c5fe224c28ebd6fad2199be129755246091310de71eb9a43d88473d5b8950
MD5 65d46eb8d694d2eb03c05e37bbd0c684
BLAKE2b-256 f20a59293654bad8bc130fc072bbf712168133a53fdddb0024fcd5fd0b0c52b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mecab_python3-1.0.6-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 511.5 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.8

File hashes

Hashes for mecab_python3-1.0.6-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 c80e58dcc90da095b64799950046dc4b9db3fb6bf30a8f817d1639cdaf601ba1
MD5 0ecc2efc6e0d96e8901a791605788a07
BLAKE2b-256 d47bc6780ea724be8a7844c8a879d57b7416f7fb6555f2631f6138074dba07f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mecab_python3-1.0.6-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 274.1 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15

File hashes

Hashes for mecab_python3-1.0.6-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 2958a94ee7ed521e95c333a7b66adcead9973db3d4f4873789c425d41726e52c
MD5 75ea1661671f6495291965e38969e708
BLAKE2b-256 d7a0dc357c903cecfe377b3c9b8679ed3554d067e2c1fe861fe65e3f00e4187f

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