Skip to main content

A Cython wrapper for MeCab

Project description

Current PyPI packages

fugashi

Fugashi by Irasutoya

Fugashi is a Cython wrapper for MeCab.

See the blog post for background on why Fugashi exists and some of the design decisions.

Any reasonable version of MeCab should work, but it's recommended you install from source.

Usage

from fugashi import Tagger

tagger = Tagger('-Owakati')
text = "麩菓子(ふがし)は、麩を主材料とした日本の菓子。"
tagger.parse(text)
# => '麩 菓子 ( ふ が し ) は 、 麩 を 主材 料 と し た 日本 の 菓子 。'
for word in tagger.parseToNodeList(text):
    print(word, word.feature.lemma, word.pos, sep='\t')
    # "feature" is the Unidic feature data as a named tuple

Dictionary Use

Fugashi is written with the assumption you'll use Unidic to process Japanese, but it supports arbitrary dictionaries.

If you're using a dictionary besides Unidic you can use the GenericTagger like this:

from fugashi import GenericTagger
tagger = GenericTagger()

# parse can be used as normal
tagger.parse('something')
# features from the dictionary can be accessed by field numbers
for word in tagger.parseToNodeList(text):
    print(word.surface, word.feature[0])

You can also create a dictionary wrapper to get feature information as a named tuple.

from fugashi import GenericTagger, create_feature_wrapper
CustomFeatures = create_feature_wrapper('CustomFeatures', 'alpha beta gamma')
tagger = GenericTagger(wrapper=CustomFeatures)
for word in tagger.parseToNodeList(text):
    print(word.surface, word.feature.alpha)

Alternatives

If you have a problem with Fugashi feel free to open an issue. However, there are some cases where it might be better to use a different library.

  • If you want to use MeCab but don't have a C compiler, use natto-py.
  • If you don't want to deal with installing MeCab at all, try SudachiPy.

Note that these are both slower than Fugashi according to a benchmark I wrote.

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

fugashi-0.1.12rc3.tar.gz (331.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fugashi-0.1.12rc3-cp38-cp38-win_amd64.whl (501.8 kB view details)

Uploaded CPython 3.8Windows x86-64

fugashi-0.1.12rc3-cp38-cp38-manylinux1_x86_64.whl (490.6 kB view details)

Uploaded CPython 3.8

fugashi-0.1.12rc3-cp37-cp37m-win_amd64.whl (500.7 kB view details)

Uploaded CPython 3.7mWindows x86-64

fugashi-0.1.12rc3-cp37-cp37m-manylinux1_x86_64.whl (483.9 kB view details)

Uploaded CPython 3.7m

fugashi-0.1.12rc3-cp36-cp36m-win_amd64.whl (500.7 kB view details)

Uploaded CPython 3.6mWindows x86-64

fugashi-0.1.12rc3-cp36-cp36m-manylinux1_x86_64.whl (485.0 kB view details)

Uploaded CPython 3.6m

fugashi-0.1.12rc3-cp35-cp35m-win_amd64.whl (499.3 kB view details)

Uploaded CPython 3.5mWindows x86-64

fugashi-0.1.12rc3-cp35-cp35m-manylinux1_x86_64.whl (479.9 kB view details)

Uploaded CPython 3.5m

File details

Details for the file fugashi-0.1.12rc3.tar.gz.

File metadata

  • Download URL: fugashi-0.1.12rc3.tar.gz
  • Upload date:
  • Size: 331.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for fugashi-0.1.12rc3.tar.gz
Algorithm Hash digest
SHA256 1a2f6049a35d7d2bc3125d050bf15f5bb1f695878b1f990b341eee5ea2c7c6ed
MD5 4ffc029d882ba24068196801f3a2d77f
BLAKE2b-256 dbef2b740cc49116c3b5820a35b02be13b23bf7a42f4780f2af6aef4ce01581a

See more details on using hashes here.

File details

Details for the file fugashi-0.1.12rc3-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: fugashi-0.1.12rc3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 501.8 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for fugashi-0.1.12rc3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 39e5477ba89a5f590c386362ec0a89c4eb30aa42c4373334a8ab37724102b170
MD5 b68174d0ba7c5f82dfa0e2e169bc59a3
BLAKE2b-256 44e1671b41ad1385ccb3f8805e389bd227781fa93100c920e982a0005afeea39

See more details on using hashes here.

File details

Details for the file fugashi-0.1.12rc3-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: fugashi-0.1.12rc3-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 490.6 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for fugashi-0.1.12rc3-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 c60d5e0f57226850d8e8b701759a8c65e573ff059b78dea6451af6ecf52256c8
MD5 e8836cd90ebdc549da73f5bf3d800748
BLAKE2b-256 511ec6635ea79a10824428111e3240ef5da108704f854b7c15bc93fd83677761

See more details on using hashes here.

File details

Details for the file fugashi-0.1.12rc3-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: fugashi-0.1.12rc3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 500.7 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for fugashi-0.1.12rc3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 bcfb7d235d424b2ceff6d51335481a9cfcf248e9f99621207a7e3c3df40fe3d5
MD5 58bcdeb943c01bb7742479d1122483df
BLAKE2b-256 f0b70de0364ecaceffcbe1341b5db8fbe99da9e9a4e2ff49fc91da396dc346d9

See more details on using hashes here.

File details

Details for the file fugashi-0.1.12rc3-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: fugashi-0.1.12rc3-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 483.9 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for fugashi-0.1.12rc3-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 371c2f6ac4e984ac1219a0b8e342c7d81a6732edf59a2ce6abfeaf0da4c176b8
MD5 958ee4594cf666fb3fd5c859e67a161b
BLAKE2b-256 c9ef0f55d3bdda22db04324c5456a52a04b84c08efeb29fd1035afd79740754b

See more details on using hashes here.

File details

Details for the file fugashi-0.1.12rc3-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: fugashi-0.1.12rc3-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 500.7 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for fugashi-0.1.12rc3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 434416ea42b1256c79edbacfdac3c75f84df575dfe3affa899517f0b5e719fa2
MD5 90b333d32298d99f9410ceeb7edc13df
BLAKE2b-256 ce4d786912dee1d023670d91142817da74256d5d30200780474585a953f4f869

See more details on using hashes here.

File details

Details for the file fugashi-0.1.12rc3-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: fugashi-0.1.12rc3-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 485.0 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for fugashi-0.1.12rc3-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 703bd8e3ba6df217bc6b7201685ba96d1bca35f023d346635644be8511070efb
MD5 bcd02a13531b2e25d22ddba965635ec4
BLAKE2b-256 18cec45926a6ea0dce75a1fcc37d118ea7eea5f1b9aa33c474762db0bbdf06f9

See more details on using hashes here.

File details

Details for the file fugashi-0.1.12rc3-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: fugashi-0.1.12rc3-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 499.3 kB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for fugashi-0.1.12rc3-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 88280dbe64021f7955bafb33d6b2950c1ef0a119540c9e2a2c0741fdd3cac849
MD5 bdd3e4a2fb0b9c3f7f7134c041c60d86
BLAKE2b-256 7aeaece09ed9f052f28f55ace443900f89d4cee6ae3fdcd3f16cee2ee8c0cabb

See more details on using hashes here.

File details

Details for the file fugashi-0.1.12rc3-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: fugashi-0.1.12rc3-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 479.9 kB
  • Tags: CPython 3.5m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.8.1

File hashes

Hashes for fugashi-0.1.12rc3-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 fe2b846069a3bc7bfb64cc5adcb4fe8a4b81c47dc7cb1af6637828efc7dc57b2
MD5 93ea21257a055ca9bc8fce0796d97925
BLAKE2b-256 fe58de8ed6035c8cc92348c6db960c2f4cc72f7102d2dbd199e069a08e05f419

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