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 a copy of the MeCab-ko library and a dictionary.
There is a unique dictionary available for MeCab-ko. mecab-ko-dic
is automatically installed when installing pymacab-ko.
- 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.
To build from source using pip,
pip install --no-binary :all: 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.
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
- python-mecab-ko is a Python binding for MeCab-ko
- mecab-python-msvc is a mecab-python for mecab-ko-msvc
- KoNLPy is a library for Korean NLP that includes a MeCab wrapper
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
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 Distribution
Built Distributions
Hashes for mecab_ko-1.0.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ca6822b1cc732f1163891a46940d360e89606cf32e3fb5a757aababd8cfa61a |
|
MD5 | 66a8eccc940786f72c093ad83432e392 |
|
BLAKE2b-256 | 847221e26cdc56f41a8ca8abd463206c05756a0483fd38d009b686987a0fffe5 |
Hashes for mecab_ko-1.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b072e896e44c0b4d7d7fb51217e211152fd8de5de9e17d4885d718bb0bce2396 |
|
MD5 | cd8ada9a9f915972bd935c62515ecd75 |
|
BLAKE2b-256 | 7fbd05f95690eb5dc59ee6a8ed65f63feefd31f5bc418bc30df8c7accfb10d44 |
Hashes for mecab_ko-1.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3061e9205b60c38f80c866e3cd6fb7b0e6e0405f4d99db99efe183206f7bfa86 |
|
MD5 | ba4e8e0114f3e0d114f033b2d38e7df0 |
|
BLAKE2b-256 | 690db84419c84599aa95d9bef41cf5b9544b4c535198b33fde5fdb901a6a5677 |
Hashes for mecab_ko-1.0.0-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb450cb9fb1fb3ec2b8ccf30eca7af602e695bed537b9048e655847b30e652a7 |
|
MD5 | c0775306e7795fbdca2ad4f3e63d1d56 |
|
BLAKE2b-256 | 137b65f99e04b47f3807de7686491290e49f74ac1aec2026a40d04605d7aff9d |
Hashes for mecab_ko-1.0.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbae0541b819d0f2093fcabd2f849422287754405b5e38d75bc3c1bfcc8a7120 |
|
MD5 | 69e5e3631e7f6d9a0ebf0ba05cd6a69c |
|
BLAKE2b-256 | ddb9753450727d5f3de273b718d5bcc962f57784378aba01bacdc560f8e55618 |
Hashes for mecab_ko-1.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56101c3e7fea41d37251684772ccdf0aaf8f8f944503e22502d923d9a643e0d4 |
|
MD5 | 953cdc9f51c6aad1bc70c30842331664 |
|
BLAKE2b-256 | 997ed9bc0fc75c212abfd1eb8723133ea3bfb1a148a0381b6bb076bcd5fc3981 |
Hashes for mecab_ko-1.0.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5eefb4e8b48b0bf496ac6469b83426ae728762d8e2aefe1a68a5eb6244fcfb5 |
|
MD5 | d14c0a8b4d8a22dfc99df8d79c04fa2f |
|
BLAKE2b-256 | c42af16d1d76061864edb93ba8000e131f9688e66e03cee8bf1226243a2dbea6 |
Hashes for mecab_ko-1.0.0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2acf9701b3f0d135af6ebe06d0eef693e71a5f91a7199eb938289ccb96a598ed |
|
MD5 | 6a2324a0c3e16915bd2520673fd005ed |
|
BLAKE2b-256 | 946181f37fbb8291435d086acdf96145ef442cdeccdadbcafa38e71a86f0f633 |
Hashes for mecab_ko-1.0.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 435cf15cc1075b219910d64a6d9282b5d5eb2f785a52999a1f16272b0cef7d49 |
|
MD5 | d02c926c4824d7160eb40fcf6a27441e |
|
BLAKE2b-256 | eecb5fa152c7ce21b22ebec67dc4ddb83d6e41fb9c2f0f44e702532af52671fb |
Hashes for mecab_ko-1.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f1fc326dcb9de334b6957c717466f20ba473191d9a028d45af9899f718586b97 |
|
MD5 | e65ca61191bd19240f0026cbe732fd43 |
|
BLAKE2b-256 | 7b441ed50e507d2166bd6dbfd14710eaf9a46a015e27a175068ec27f50b74ed4 |
Hashes for mecab_ko-1.0.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a732c16df0aeda443ff6b0d563decad2ae53f799992af0aaaa6fef8fd91a47ee |
|
MD5 | 9b7fb2a967d3eb056683c89ba412bda3 |
|
BLAKE2b-256 | 9419dad295f37270a3841b436f89d2bd7c7ab0fe345d0b45df1570803df8429f |
Hashes for mecab_ko-1.0.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10b92bb6616ae461a8af774d5b606c03f2b2e2d5f1226b858ab81b5680b12ef7 |
|
MD5 | 9bc225fc0c14856e6a607c21d266b3ae |
|
BLAKE2b-256 | 1dbc4aa9e995f58287fb44c7895d49eafc49738f1383f22248f383dc1b7a559a |
Hashes for mecab_ko-1.0.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ce6c16735415fa003ab455f4db39d9a2c7e66bece806f8f8963495a8eaa81c3 |
|
MD5 | 038834f637642d00d64530bf6edb5c11 |
|
BLAKE2b-256 | 09938e7679813cabacad11cc6b2b742f7364bb851cd91a537c1a5e2051ecbc7b |
Hashes for mecab_ko-1.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf3609fef6a81dfa4068f7e502521f92450ff404823eb09e36355e812878cfe7 |
|
MD5 | 4be74412444d392a08a45ed4a757d818 |
|
BLAKE2b-256 | 4ea8491dc876bad6ee0a1d21d4aaadfb9c18162a1db1391d7bc701b8a45b1f0d |
Hashes for mecab_ko-1.0.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46d66ccd617c4a4b54fe90d620418cd6254619fe48589865911cf594b470bb77 |
|
MD5 | 696d4342211a776f3591cf041f046c08 |
|
BLAKE2b-256 | f62f6c4d636488e2b5a1c02c89086af4108aab2d496072c90751e6348e4816bc |
Hashes for mecab_ko-1.0.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d7c8f4bd0276beccc7e5bfa2ce055df5ace32316b8802d2f71acb40a0b3a68a |
|
MD5 | 85f84130cb8fcf403f729954dc5275e3 |
|
BLAKE2b-256 | 51444be8c8cab3d490eca7c92326a77473e8b7a29e5b93726fde134de602b979 |
Hashes for mecab_ko-1.0.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fac1405b8fd3b57fc88c3018133c6f0a5d0691bde8b58a718b7953372e19389 |
|
MD5 | 393613fb9bf82c310a1ca2e2f08b193a |
|
BLAKE2b-256 | 1827baf2ae74c013a9e62ca12e5dd4b0741e82c583308fbfa4a1830cb32aec11 |
Hashes for mecab_ko-1.0.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26d88f9c8d19999556e6eb93817a563bab09fe75d1252f289a96dcba738e6752 |
|
MD5 | 82d1bb4d08e91a2ce36c08b51c9c757d |
|
BLAKE2b-256 | 34d6851bd4d8f6779a29c5d91db877c96e7ef7c5bf1811c66a16cb93718b90ef |
Hashes for mecab_ko-1.0.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 213a15a331f4cea28905135667ebdfa92c260ab8156493dcfb5ecdfabb81c89d |
|
MD5 | 0f8e402230d975e87168e52798a620d3 |
|
BLAKE2b-256 | fe4a04f7bbb5c6cd4d2bab6e6e057bc02b6035b56ee5b180f4ed780f227c4a3b |
Hashes for mecab_ko-1.0.0-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78bd0385e654f19e16f8b47897a5976776e1ce1c181ca73b041ce4aa5469350d |
|
MD5 | 35eebfbae289047144015c4f5fd5a4c7 |
|
BLAKE2b-256 | 5a848057ab99cde3b9bb6303d3101cc16ec8f630cc823ced5117e91489686194 |