Unofficial MeCab binding Python module for many OSs (Windows, macOS, and Linux)
Official Japanese document about MeCab is available: https://taku910.github.io/mecab/
Japanese document about this Python wrapper is available: https://qiita.com/yukinoi/items/990b6933d9f21ba0fb43
Installation
=============
$ pip install mecab
or
$ python -m pip install mecab
NOTE: If you use Python 64-bit on Windows, `MeCab 64-bit binary <https://github.com/ikegami-yukino/mecab/releases>`_ is required.
If you encountered the error such as **MeCab_wrap.cxx:178:11: fatal error: 'Python.h' file not found**, please try the following command:
$ CPLUS_INCLUDE_PATH=`python-config --prefix`/Headers:$CPLUS_INCLUDE_PATH pip install mecab
Usage
============
.. code:: python
>>> import MeCab
>>> t = MeCab.Tagger()
>>> sentence = "太郎はこの本を女性に渡した。"
>>> print(t.parse(sentence))
太郎 名詞,固有名詞,人名,名,*,*,太郎,タロウ,タロー
は 助詞,係助詞,*,*,*,*,は,ハ,ワ
この 連体詞,*,*,*,*,*,この,コノ,コノ
本 名詞,一般,*,*,*,*,本,ホン,ホン
を 助詞,格助詞,一般,*,*,*,を,ヲ,ヲ
女性 名詞,一般,*,*,*,*,女性,ジョセイ,ジョセイ
に 助詞,格助詞,一般,*,*,*,に,ニ,ニ
渡し 動詞,自立,*,*,五段・サ行,連用形,渡す,ワタシ,ワタシ
た 助動詞,*,*,*,特殊・タ,基本形,た,タ,タ
。 記号,句点,*,*,*,*,。,。,。
EOS
>>> n = t.parseToNode(sentence)
>>> while n:
>>> print(n.surface, "\t", n.feature)
>>> m = m.next
BOS/EOS,*,*,*,*,*,*,*,*
太郎 名詞,固有名詞,人名,名,*,*,太郎,タロウ,タロー
は 助詞,係助詞,*,*,*,*,は,ハ,ワ
この 連体詞,*,*,*,*,*,この,コノ,コノ
本 名詞,一般,*,*,*,*,本,ホン,ホン
を 助詞,格助詞,一般,*,*,*,を,ヲ,ヲ
女性 名詞,一般,*,*,*,*,女性,ジョセイ,ジョセイ
に 助詞,格助詞,一般,*,*,*,に,ニ,ニ
渡し 動詞,自立,*,*,五段・サ行,連用形,渡す,ワタシ,ワタシ
た 助動詞,*,*,*,特殊・タ,基本形,た,タ,タ
。 記号,句点,*,*,*,*,。,。,。
BOS/EOS,*,*,*,*,*,*,*,*
License
============
MeCab is copyrighted free software by Taku Kudo <taku@chasen.org> and Nippon Telegraph and Telephone Corporation, and is released under any of the GPL (see the file GPL), the LGPL (see the file LGPL), or the BSD License (see the file BSD).
Also, this Python binding is under any of the GPL, the LGPL, or the BSD License.
Changes
============
0.996.5 (2024/10/15)
----------------------------
- Update MeCab_wrap.cxx by SWIG 4.2.1 for support latest macOS
0.996.2 (2020/02/11)
----------------------------
- Bugfix: memory leak for MeCab.Tagger().parseToNode()
Contributing
===============
See https://github.com/ikegami-yukino/mecab/blob/master/mecab/python/CONTRIBUTING.md
Raw data
{
"_id": null,
"home_page": "https://github.com/ikegami-yukino/mecab/tree/master/mecab/python",
"name": "mecab",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Yukino Ikegami",
"author_email": "yknikgm@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a7/44/b7049fcc00c34819aa59d0994b130217b615a5238de8b02ca0e0350af7f4/mecab-0.996.5.tar.gz",
"platform": null,
"description": "Unofficial MeCab binding Python module for many OSs (Windows, macOS, and Linux)\n\nOfficial Japanese document about MeCab is available: https://taku910.github.io/mecab/\n\nJapanese document about this Python wrapper is available: https://qiita.com/yukinoi/items/990b6933d9f21ba0fb43\n\nInstallation\n=============\n\n$ pip install mecab\n\nor\n\n$ python -m pip install mecab\n\nNOTE: If you use Python 64-bit on Windows, `MeCab 64-bit binary <https://github.com/ikegami-yukino/mecab/releases>`_ is required.\n\nIf you encountered the error such as **MeCab_wrap.cxx:178:11: fatal error: 'Python.h' file not found**, please try the following command:\n\n$ CPLUS_INCLUDE_PATH=`python-config --prefix`/Headers:$CPLUS_INCLUDE_PATH pip install mecab\n\nUsage\n============\n\n.. code:: python\n\n >>> import MeCab\n >>> t = MeCab.Tagger()\n >>> sentence = \"\u592a\u90ce\u306f\u3053\u306e\u672c\u3092\u5973\u6027\u306b\u6e21\u3057\u305f\u3002\"\n >>> print(t.parse(sentence))\n \u592a\u90ce \u540d\u8a5e,\u56fa\u6709\u540d\u8a5e,\u4eba\u540d,\u540d,*,*,\u592a\u90ce,\u30bf\u30ed\u30a6,\u30bf\u30ed\u30fc\n \u306f \u52a9\u8a5e,\u4fc2\u52a9\u8a5e,*,*,*,*,\u306f,\u30cf,\u30ef\n \u3053\u306e \u9023\u4f53\u8a5e,*,*,*,*,*,\u3053\u306e,\u30b3\u30ce,\u30b3\u30ce\n \u672c \u540d\u8a5e,\u4e00\u822c,*,*,*,*,\u672c,\u30db\u30f3,\u30db\u30f3\n \u3092 \u52a9\u8a5e,\u683c\u52a9\u8a5e,\u4e00\u822c,*,*,*,\u3092,\u30f2,\u30f2\n \u5973\u6027 \u540d\u8a5e,\u4e00\u822c,*,*,*,*,\u5973\u6027,\u30b8\u30e7\u30bb\u30a4,\u30b8\u30e7\u30bb\u30a4\n \u306b \u52a9\u8a5e,\u683c\u52a9\u8a5e,\u4e00\u822c,*,*,*,\u306b,\u30cb,\u30cb\n \u6e21\u3057 \u52d5\u8a5e,\u81ea\u7acb,*,*,\u4e94\u6bb5\u30fb\u30b5\u884c,\u9023\u7528\u5f62,\u6e21\u3059,\u30ef\u30bf\u30b7,\u30ef\u30bf\u30b7\n \u305f \u52a9\u52d5\u8a5e,*,*,*,\u7279\u6b8a\u30fb\u30bf,\u57fa\u672c\u5f62,\u305f,\u30bf,\u30bf\n \u3002 \u8a18\u53f7,\u53e5\u70b9,*,*,*,*,\u3002,\u3002,\u3002\n EOS\n >>> n = t.parseToNode(sentence)\n >>> while n:\n >>> print(n.surface, \"\\t\", n.feature)\n >>> m = m.next\n BOS/EOS,*,*,*,*,*,*,*,*\n \u592a\u90ce \u540d\u8a5e,\u56fa\u6709\u540d\u8a5e,\u4eba\u540d,\u540d,*,*,\u592a\u90ce,\u30bf\u30ed\u30a6,\u30bf\u30ed\u30fc\n \u306f \u52a9\u8a5e,\u4fc2\u52a9\u8a5e,*,*,*,*,\u306f,\u30cf,\u30ef\n \u3053\u306e \u9023\u4f53\u8a5e,*,*,*,*,*,\u3053\u306e,\u30b3\u30ce,\u30b3\u30ce\n \u672c \u540d\u8a5e,\u4e00\u822c,*,*,*,*,\u672c,\u30db\u30f3,\u30db\u30f3\n \u3092 \u52a9\u8a5e,\u683c\u52a9\u8a5e,\u4e00\u822c,*,*,*,\u3092,\u30f2,\u30f2\n \u5973\u6027 \u540d\u8a5e,\u4e00\u822c,*,*,*,*,\u5973\u6027,\u30b8\u30e7\u30bb\u30a4,\u30b8\u30e7\u30bb\u30a4\n \u306b \u52a9\u8a5e,\u683c\u52a9\u8a5e,\u4e00\u822c,*,*,*,\u306b,\u30cb,\u30cb\n \u6e21\u3057 \u52d5\u8a5e,\u81ea\u7acb,*,*,\u4e94\u6bb5\u30fb\u30b5\u884c,\u9023\u7528\u5f62,\u6e21\u3059,\u30ef\u30bf\u30b7,\u30ef\u30bf\u30b7\n \u305f \u52a9\u52d5\u8a5e,*,*,*,\u7279\u6b8a\u30fb\u30bf,\u57fa\u672c\u5f62,\u305f,\u30bf,\u30bf\n \u3002 \u8a18\u53f7,\u53e5\u70b9,*,*,*,*,\u3002,\u3002,\u3002\n BOS/EOS,*,*,*,*,*,*,*,*\n\nLicense\n============\nMeCab is copyrighted free software by Taku Kudo <taku@chasen.org> and Nippon Telegraph and Telephone Corporation, and is released under any of the GPL (see the file GPL), the LGPL (see the file LGPL), or the BSD License (see the file BSD).\n\nAlso, this Python binding is under any of the GPL, the LGPL, or the BSD License.\n\nChanges\n============\n\n0.996.5 (2024/10/15)\n----------------------------\n\n- Update MeCab_wrap.cxx by SWIG 4.2.1 for support latest macOS\n\n\n0.996.2 (2020/02/11)\n----------------------------\n\n- Bugfix: memory leak for MeCab.Tagger().parseToNode()\n\nContributing\n===============\n\nSee https://github.com/ikegami-yukino/mecab/blob/master/mecab/python/CONTRIBUTING.md\n",
"bugtrack_url": null,
"license": "BSD, GPL or LGPL",
"summary": "MeCab binding for many OSs (Windows, macOS, and Linux)",
"version": "0.996.5",
"project_urls": {
"Homepage": "https://github.com/ikegami-yukino/mecab/tree/master/mecab/python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a744b7049fcc00c34819aa59d0994b130217b615a5238de8b02ca0e0350af7f4",
"md5": "1504611722da6d75d575d7521a17feb0",
"sha256": "fdf37f85c337d908b4ddcf43b4eff5a3c354958ca9c22fca783d24de54cfeae7"
},
"downloads": -1,
"filename": "mecab-0.996.5.tar.gz",
"has_sig": false,
"md5_digest": "1504611722da6d75d575d7521a17feb0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 64020,
"upload_time": "2024-10-15T02:17:45",
"upload_time_iso_8601": "2024-10-15T02:17:45.833057Z",
"url": "https://files.pythonhosted.org/packages/a7/44/b7049fcc00c34819aa59d0994b130217b615a5238de8b02ca0e0350af7f4/mecab-0.996.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-15 02:17:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ikegami-yukino",
"github_project": "mecab",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "mecab"
}