Skip to main content

Python wrapper for the MeCab-ko morphological analyzer for Korean

Project description

This is a Python wrapper for the MeCab-ko morphological analyzer for Korean text. It works with Python 3.6 and greater.

There are several implementations of python binding or wrapper for MeCab-ko, but they are generally not well maintained.
I made it to stand on the shoulders of giants(well-maintained open-source projects like MeCab, mecab-ko and mecab-python3) with minimum modifications.
I initially named it mecab-ko-python3 because the package name referenced for development was mecab-python3,
it may seem a little arrogant, but to reduce confusion in the PyPI, the name was changed to 'mecab-ko'.
(The repository is named 'pymecab-ko' to distinguish it from original mecab-ko)

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_ko as MeCab
>>> tagger = MeCab.Tagger("-Owakati")
>>> tagger.parse("아버지가방에들어가신다").split()
['아버지', '가', '방', '에', '들어가', '신다']

>>> tagger = MeCab.Tagger()
>>> print(tagger.parse("아버지가방에들어가신다"))
아버지  NNG,*,F,아버지,*,*,*,*
      JKS,*,F,,*,*,*,*
      NNG,*,T,,*,*,*,*
      JKB,*,F,,*,*,*,*
들어가  VV,*,F,들어가,*,*,*,*
신다    EP+EC,*,F,신다,Inflect,EP,EC,/EP/*+ㄴ다/EC/*
EOS

The API for pymecab-ko 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-ko

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. mecab-ko-dic is a good one to start with:

pip install mecab-ko-dic

To build from source using pip,

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

Dictionaries

There is a unique dictionary available for MeCab-ko. These UniDic packages, which include slight modifications for ease of use, are recommended:

  • mecab-ko-dic: The pre-built mecab-ko-dic 2.1.1-20180720 based on ipadic-py.
  • mecab-ko-dic: The original source-code of mecab-ko-dic to build dictionary for mecab-ko.

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 mecab-ko-dic 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, mecab-ko-dic does not include Chasen output format. Please see the MeCab documentation.

Alternatives

Licensing

Like MeCab and mecab-python3, pymecab-ko 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


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_ko-0.0.1a1-cp39-cp39-win_amd64.whl (500.0 kB view details)

Uploaded CPython 3.9Windows x86-64

mecab_ko-0.0.1a1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (561.1 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

mecab_ko-0.0.1a1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl (489.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.5+ x86-64

mecab_ko-0.0.1a1-cp39-cp39-macosx_10_14_x86_64.whl (283.8 kB view details)

Uploaded CPython 3.9macOS 10.14+ x86-64

mecab_ko-0.0.1a1-cp38-cp38-win_amd64.whl (500.1 kB view details)

Uploaded CPython 3.8Windows x86-64

mecab_ko-0.0.1a1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (556.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

mecab_ko-0.0.1a1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl (491.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.5+ x86-64

mecab_ko-0.0.1a1-cp38-cp38-macosx_10_14_x86_64.whl (283.9 kB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

mecab_ko-0.0.1a1-cp37-cp37m-win_amd64.whl (500.0 kB view details)

Uploaded CPython 3.7mWindows x86-64

mecab_ko-0.0.1a1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (553.0 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ ARM64

mecab_ko-0.0.1a1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (489.2 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.5+ x86-64

mecab_ko-0.0.1a1-cp37-cp37m-macosx_10_14_x86_64.whl (283.8 kB view details)

Uploaded CPython 3.7mmacOS 10.14+ x86-64

mecab_ko-0.0.1a1-cp36-cp36m-win_amd64.whl (510.0 kB view details)

Uploaded CPython 3.6mWindows x86-64

mecab_ko-0.0.1a1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (552.8 kB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.17+ ARM64

mecab_ko-0.0.1a1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl (489.0 kB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.5+ x86-64

mecab_ko-0.0.1a1-cp36-cp36m-macosx_10_14_x86_64.whl (283.8 kB view details)

Uploaded CPython 3.6mmacOS 10.14+ x86-64

File details

Details for the file mecab_ko-0.0.1a1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: mecab_ko-0.0.1a1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 500.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for mecab_ko-0.0.1a1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3491464e2e31f33d763772390a2d81a43789f4c2f73a26e8473288653b2a0fad
MD5 5ff67f5017d888a73baf345bacc53191
BLAKE2b-256 eeaa0568ca3e6076da6b98ad284e6f4d12704893175b7f3be8795d750bd8f72d

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mecab_ko-0.0.1a1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e656aa80deb93710da01ef6c9d8c5ea86f27eeadc062bb931be0f0afdb99fd09
MD5 d3ecd7df29146bc56a90f92461612679
BLAKE2b-256 bd5a02c64741e027ab7233dad0c50f8c17619f13c25e8d9e444dc405cb8a1f35

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

  • Download URL: mecab_ko-0.0.1a1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
  • Upload date:
  • Size: 489.8 kB
  • Tags: CPython 3.9, manylinux: glibc 2.5+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for mecab_ko-0.0.1a1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 189c8b8fd42bd563fba741de92e693646c885eb73a5ffc446f47b942a0a4a98e
MD5 720ffdababefb18b210640f097a4634e
BLAKE2b-256 d1007de687176e9b914032b98e39b6bab70b27934716fa0dcf9fe3e71c67f1bb

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mecab_ko-0.0.1a1-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 283.8 kB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for mecab_ko-0.0.1a1-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 86f6ec08f52e760c06a176f0c0dc6b84e1a3b0e033cc8fb8db3f029f65dbfa85
MD5 9c336f9be480edfc5c3540e3efe3d02f
BLAKE2b-256 b6b04a72e601dd8c33bb2e3ad27cf780c878aeb9e5845c45c15d62548b5a9cbb

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: mecab_ko-0.0.1a1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 500.1 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for mecab_ko-0.0.1a1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 d197bfa734ff03833abd8dc9f281008c555a2486d8db04087952a139d1a5bcf7
MD5 f1de1c3c89033cbd7cec738c903a87eb
BLAKE2b-256 5dbbc61144e9f70c34d0cca75a2443aa2812bb0023e71b2de8e70354d8df49ae

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mecab_ko-0.0.1a1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 83673b886cb7465d627381305e38637638b2746ea5891622c35943bdf8183d83
MD5 d434450b6e29ab4be2fb66fca176bc88
BLAKE2b-256 f70009f0589b895a6e7852416867948a04ca0d619076e7199a0f055d6bd4f779

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

  • Download URL: mecab_ko-0.0.1a1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
  • Upload date:
  • Size: 491.3 kB
  • Tags: CPython 3.8, manylinux: glibc 2.5+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1

File hashes

Hashes for mecab_ko-0.0.1a1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 d7a2a01ab1e8bc13104ba67bd01868e4064366f59a5290ae4c58c52ba0870f4c
MD5 9a0ae65541f4cf08b4365eb4ffee245f
BLAKE2b-256 4178f18ee3fd3f74e956358adb5a98b25d54bf31e36756198f50569afc80a0fc

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mecab_ko-0.0.1a1-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 283.9 kB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

File hashes

Hashes for mecab_ko-0.0.1a1-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 b267eab3d7bf64a35080cf1c0bf807a0157b8fc64b6399bdbb582a6c33cd31c5
MD5 9e8a06ea3872d8ce9481a3a23532bfb4
BLAKE2b-256 7afba42e3079d6407a2003475af25885eef41c3ef2d5f1293ed26a3a721f2e4c

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: mecab_ko-0.0.1a1-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 500.0 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for mecab_ko-0.0.1a1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 90fa116a00b1d2b1abbf8405db8531bd7775721d4a18dd2f7badfee433192ab6
MD5 0faa42f45931724ab5cd794b2413b0b7
BLAKE2b-256 c73e3845643afcc5b072da6acb235eff0888a460aebfe4783585b538e93ffe9b

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mecab_ko-0.0.1a1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fbe43cb87504addf2037716506b8c8b0978b2bd379eabb13ff40da2b1c99badf
MD5 8803b5d952f0932aaf93828fcb8f8222
BLAKE2b-256 7ada0f8f1af78830d4e1abc27305c6d9c8b5686ccb3e586c5b24b2093f54c0a6

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mecab_ko-0.0.1a1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 082105870875e198ad914c16f6ea7a72c7afcbe6c7a09b24a91960036d4fb767
MD5 ce2b9129b66eb684e2732cb3bdab4612
BLAKE2b-256 09adb5efff4509348a3f8211ef4520b786a643a7f7f22721250aec802dc266b1

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mecab_ko-0.0.1a1-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 283.8 kB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for mecab_ko-0.0.1a1-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 e33ea1dd40a0bbf9a904e975f1af88d2bc1b8fb8a709dcfbd3653603241c0f4a
MD5 515fbde51787ff935abe42aee08cbdb6
BLAKE2b-256 68f43db52d5fbd5912d5cc1872a013bdc16f91f672a92a867ba8066d5ef4d734

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: mecab_ko-0.0.1a1-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 510.0 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8

File hashes

Hashes for mecab_ko-0.0.1a1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 51f5246ade33d7d424b2753e4c4dc418bdc1cde401010903ede76496accb38f0
MD5 d49bc4f99c797e9543dd204be0dcc032
BLAKE2b-256 a3715e4c4003459df972a457780c69194a3944d8b733ccc671dfe9844202e786

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for mecab_ko-0.0.1a1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f7bd32eaf72008777f2e4d060d8f85195e21288c24a3a81e4303f4c33ca3b5fa
MD5 a7c92ef46faddd8e105ada1189b36cc5
BLAKE2b-256 7f8d585a25e8c104395b8515b81b8bb0a148810f9bf24ce645b3d9db8717b9c8

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for mecab_ko-0.0.1a1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 cf5cfe232e1ddfe4bb12dfdad4772621f704b1236d9ac424a68138ac5a3c5fe1
MD5 a4e3f68d1bd98a1f2f788dc571549230
BLAKE2b-256 62d8b25fad15ff2e241c86a074c01d5cbdaad4904937c6c70d2162f1c51a7a25

See more details on using hashes here.

File details

Details for the file mecab_ko-0.0.1a1-cp36-cp36m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: mecab_ko-0.0.1a1-cp36-cp36m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 283.8 kB
  • Tags: CPython 3.6m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.15

File hashes

Hashes for mecab_ko-0.0.1a1-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 178bd12e578d3057ff3738ec5a3dd8a10b96dc7866450f290f503431b80ca929
MD5 fc2633455b8a7566bc145ee1724b8c01
BLAKE2b-256 63c25aa9425a3d86a4e2b7d7572b67770147929baa5bcd683534b0e7108e4d37

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