Skip to main content

A python binding for mecab-ko

Project description

python-mecab-ko

A python binding for mecab-ko

Help

See documentation for more details.

Installation

Using pip:

$ pip install python-mecab-ko

Usage

To perform morpheme analysis, you need to make a MeCab instance first:

>>> from mecab import MeCab
>>> mecab = MeCab()

To extract morphemes in a given sentence, use mecab.morphs():

>>> mecab.morphs('영등포구청역에 있는 맛집 좀 알려주세요.')
['영등포구청역', '에', '있', '는', '맛집', '좀', '알려', '주', '세요', '.']

To extract nouns in a given sentence, use mecab.nouns():

>>> mecab.nouns('우리나라에는 무릎 치료를 잘하는 정형외과가 없는가!')
['우리', '나라', '무릎', '치료', '정형외과']

To perform a morpheme analysis on a given sentence, use mecab.pos():

>>> mecab.pos('자연주의 쇼핑몰은 어떤 곳인가?')
[('자연주의', 'NNG'), ('쇼핑몰', 'NNG'), ('은', 'JX'), ('어떤', 'MM'), ('곳', 'NNG'), ('인가', 'VCP+EF'), ('?', 'SF')]

If you would like to obtain detailed morpheme analysis results, use mecab.parse():

>>> mecab.parse('즐거운 하루 보내세요!')
[
    Morpheme(span=Span(start=0, end=3), surface="즐거운",
        feature=Feature(
            pos="VA+ETM", semantic=None, has_jongseong=True, reading="즐거운",
            type="Inflect", start_pos="VA", end_pos="ETM", exprssion="즐겁/VA/*+ᆫ/ETM/*",
        ),
    ),
    Morpheme(span=Span(start=4, end=6), surface="하루",
        feature=Feature(
            pos="NNG", semantic=None, has_jongseong=False, reading="하루",
            type=None, start_pos=None, end_pos=None, exprssion=None,
        ),
    ),
    Morpheme(
        span=Span(start=7, end=9), surface="보내",
        feature=Feature(
            pos="VV", semantic=None, has_jongseong=False, reading="보내",
            type=None, start_pos=None, end_pos=None, exprssion=None,
        ),
    ),
    Morpheme(
        span=Span(start=9, end=11), surface="세요",
        feature=Feature(
            pos="EP+EF", semantic=None, has_jongseong=False, reading="세요",
            type="Inflect", start_pos="EP", end_pos="EF", exprssion="시/EP/*+어요/EF/*",
        ),
    ),
    Morpheme(
        span=Span(start=11, end=12), surface="!",
        feature=Feature(
            pos="SF", semantic=None, has_jongseong=None, reading=None,
            type=None, start_pos=None, end_pos=None, exprssion=None,
        ),
    ),
]

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-mecab-ko-1.3.2.tar.gz (11.6 kB view hashes)

Uploaded Source

Built Distributions

python_mecab_ko-1.3.2-cp311-cp311-win_arm64.whl (735.6 kB view hashes)

Uploaded CPython 3.11 Windows ARM64

python_mecab_ko-1.3.2-cp311-cp311-win_amd64.whl (794.0 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

python_mecab_ko-1.3.2-cp311-cp311-win32.whl (554.3 kB view hashes)

Uploaded CPython 3.11 Windows x86

python_mecab_ko-1.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (572.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

python_mecab_ko-1.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (551.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ ARM64

python_mecab_ko-1.3.2-cp311-cp311-macosx_11_0_arm64.whl (602.4 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

python_mecab_ko-1.3.2-cp311-cp311-macosx_10_9_x86_64.whl (616.2 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

python_mecab_ko-1.3.2-cp310-cp310-win_arm64.whl (862.2 kB view hashes)

Uploaded CPython 3.10 Windows ARM64

python_mecab_ko-1.3.2-cp310-cp310-win_amd64.whl (647.7 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

python_mecab_ko-1.3.2-cp310-cp310-win32.whl (683.4 kB view hashes)

Uploaded CPython 3.10 Windows x86

python_mecab_ko-1.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (572.4 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

python_mecab_ko-1.3.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (551.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ ARM64

python_mecab_ko-1.3.2-cp310-cp310-macosx_11_0_arm64.whl (602.4 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

python_mecab_ko-1.3.2-cp310-cp310-macosx_10_9_x86_64.whl (616.1 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

python_mecab_ko-1.3.2-cp39-cp39-win_arm64.whl (859.1 kB view hashes)

Uploaded CPython 3.9 Windows ARM64

python_mecab_ko-1.3.2-cp39-cp39-win_amd64.whl (644.0 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

python_mecab_ko-1.3.2-cp39-cp39-win32.whl (683.5 kB view hashes)

Uploaded CPython 3.9 Windows x86

python_mecab_ko-1.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (573.6 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

python_mecab_ko-1.3.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (553.4 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ ARM64

python_mecab_ko-1.3.2-cp39-cp39-macosx_11_0_arm64.whl (602.5 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

python_mecab_ko-1.3.2-cp39-cp39-macosx_10_9_x86_64.whl (616.3 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

python_mecab_ko-1.3.2-cp38-cp38-win_amd64.whl (816.9 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

python_mecab_ko-1.3.2-cp38-cp38-win32.whl (683.9 kB view hashes)

Uploaded CPython 3.8 Windows x86

python_mecab_ko-1.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (573.4 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

python_mecab_ko-1.3.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (550.9 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ ARM64

python_mecab_ko-1.3.2-cp38-cp38-macosx_11_0_arm64.whl (602.3 kB view hashes)

Uploaded CPython 3.8 macOS 11.0+ ARM64

python_mecab_ko-1.3.2-cp38-cp38-macosx_10_9_x86_64.whl (616.1 kB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

python_mecab_ko-1.3.2-cp37-cp37m-win_amd64.whl (668.4 kB view hashes)

Uploaded CPython 3.7m Windows x86-64

python_mecab_ko-1.3.2-cp37-cp37m-win32.whl (553.9 kB view hashes)

Uploaded CPython 3.7m Windows x86

python_mecab_ko-1.3.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (575.1 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

python_mecab_ko-1.3.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (559.6 kB view hashes)

Uploaded CPython 3.7m manylinux: glibc 2.17+ ARM64

python_mecab_ko-1.3.2-cp37-cp37m-macosx_10_9_x86_64.whl (614.6 kB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page