YouCab: Converts MeCab Parsing Results to Python Objects
Installation
Install MeCab
MeCab is required for YouCab to work. If it is not already installed, install MeCab first.
Install YouCab
$ pip install youcab
Tokenize Japanese sentence
In this example code, we generate a tokenizer with MeCab's default dictionary and run tokenization. The tokenizer converts text into a list of Word objects.
from youcab import youcab
tokenize = youcab.generate_tokenizer()
words = tokenize("本を読んだ")
for word in words:
print("surface: " + word.surface)
print("pos : " + str(word.pos))
print("base : " + word.base)
print("c_type : " + word.c_type)
print("c_form : " + word.c_form)
print("")
surface: 本
pos : ['名詞', '一般']
base : 本
c_type :
c_form :
surface: を
pos : ['助詞', '格助詞', '一般']
base : を
c_type :
c_form :
surface: 読ん
pos : ['動詞', '自立']
base : 読む
c_type : 五段・マ行
c_form : 連用タ接続
surface: だ
pos : ['助動詞']
base : だ
c_type : 特殊・タ
c_form : 基本形
Available for any MeCab dictionary
Dictionaries such as IPAdic, UniDic and neologd are available.
from youcab import youcab
tokenize = youcab.generate_tokenizer(dicdir="/path/to/mecab/dic/dir/")
Metadata
Release files for youcab 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| youcab-0.1.3.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| youcab-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.9 kB
Release files / youcab-0.1.3.tar.gz
| Download URL | youcab-0.1.3.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea8951024811129c4ef582fa20babad8b0f08aae236baf477628b53f0617d2e0
|
|
BLAKE2b-256 checksum How to use checksums |
c47a2893d5f711f1f86a7f4c9f938660c1d0a518bd2d81c5101932d3960aee67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.1 Linux/4.18.0-240.1.1.el8_3.x86_64
|
Release files / youcab-0.1.3-py3-none-any.whl
| Download URL | youcab-0.1.3-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8486d796ec7c8594536d63e7187ae5bcf474b040b1b39d3acdf764e83ef8d75d
|
|
BLAKE2b-256 checksum How to use checksums |
666b829fcc9ef188367715fbaac4bb082e363150847f78895b92f352ad98d535
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.4 CPython/3.9.1 Linux/4.18.0-240.1.1.el8_3.x86_64
|