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.10.tar.gz (331.4 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.10-cp38-cp38-win_amd64.whl (497.3 kB view details)

Uploaded CPython 3.8Windows x86-64

fugashi-0.1.10-cp38-cp38-manylinux1_x86_64.whl (471.8 kB view details)

Uploaded CPython 3.8

fugashi-0.1.10-cp37-cp37m-win_amd64.whl (496.3 kB view details)

Uploaded CPython 3.7mWindows x86-64

fugashi-0.1.10-cp37-cp37m-manylinux1_x86_64.whl (468.3 kB view details)

Uploaded CPython 3.7m

fugashi-0.1.10-cp36-cp36m-win_amd64.whl (496.3 kB view details)

Uploaded CPython 3.6mWindows x86-64

fugashi-0.1.10-cp36-cp36m-manylinux1_x86_64.whl (469.5 kB view details)

Uploaded CPython 3.6m

fugashi-0.1.10-cp35-cp35m-win_amd64.whl (495.3 kB view details)

Uploaded CPython 3.5mWindows x86-64

fugashi-0.1.10-cp35-cp35m-manylinux1_x86_64.whl (465.0 kB view details)

Uploaded CPython 3.5m

File details

Details for the file fugashi-0.1.10.tar.gz.

File metadata

  • Download URL: fugashi-0.1.10.tar.gz
  • Upload date:
  • Size: 331.4 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.10.tar.gz
Algorithm Hash digest
SHA256 ba439ff21a98bedbb08bbb820868644e68dc8836de78e43582bab5ee95316901
MD5 c047e64de0b9cdc6125caacb7c9442a3
BLAKE2b-256 2e88156c51c78ee4ccfd54000e720f0c9814d073993b4e1f5d400d01416ddb6d

See more details on using hashes here.

File details

Details for the file fugashi-0.1.10-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: fugashi-0.1.10-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 497.3 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.10-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 75a2c6063ed80c0e9d154fa87027f5f55dbfa31bf3c846d1ad145579fcbe0c03
MD5 84759821a2867c3ac5dcfa52560b63ea
BLAKE2b-256 9596475c48dc277c5722d0af505e78c9124a8c5b6281419ce5acfd988b356f57

See more details on using hashes here.

File details

Details for the file fugashi-0.1.10-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: fugashi-0.1.10-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 471.8 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.10-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 30eb803621080501408ec771414f2d96a3f1e8f26db9602cd3470589b2dfd620
MD5 2a94c86fbca9557283f3baf3931651e7
BLAKE2b-256 69ceda407cb65bbbb867af5d93c502136139e938e8a7091ecc5ccc4602434299

See more details on using hashes here.

File details

Details for the file fugashi-0.1.10-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: fugashi-0.1.10-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 496.3 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.10-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 a7e6b4f1e8c77edaae9005a7e17e7e36e0afb7f11b84c483e583cfb179463e73
MD5 16df0b6a82ef588bb1470d914fca2159
BLAKE2b-256 bc158b7a90798a5daad060ecae53cf6bcf603a3614d5529576669787bf08927a

See more details on using hashes here.

File details

Details for the file fugashi-0.1.10-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: fugashi-0.1.10-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 468.3 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.10-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9b47d53419350c77a8b2391a51e7660965cb4f5fa66574c0558637a9a8d44876
MD5 cb6066f6cf2ed80c450af56be5f1442a
BLAKE2b-256 b22406a1adc56ae87b141d3b0ed715da0ce13665122a725f586903f29e39fc77

See more details on using hashes here.

File details

Details for the file fugashi-0.1.10-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: fugashi-0.1.10-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 496.3 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.10-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 36abe73b1eb3b3f31f39bfe8c5a2b1511a472ed9023d5c15e76555e6df8b39ba
MD5 210828c816dd9de82fbcfd96e5c33747
BLAKE2b-256 4b6d9ef6fc01e38403c1c0f55a6fa7318cce7d5edc0106d9e7bf05e9585c1b4f

See more details on using hashes here.

File details

Details for the file fugashi-0.1.10-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: fugashi-0.1.10-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 469.5 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.10-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 946e024a712da89bf5dbadc559fed3bac85b75444c7d7cc1a0a7af0100649d5b
MD5 444ed8de4787e6fbd20ef509036ef4fa
BLAKE2b-256 641e1b7d7ed6606c50e589d34171f775033d4d97596a247256972eb76af60aab

See more details on using hashes here.

File details

Details for the file fugashi-0.1.10-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: fugashi-0.1.10-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 495.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.10-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 40c9cd56a539a2383833029985e30db9851cade8fc53eae2ff25039318b6f412
MD5 2b94b80bb1b459000e4e9bddcfed041c
BLAKE2b-256 0cb585bdba9b85241a0161ff0a8dee0b5a11622f9aa0e4e426da42b6bf8ed0d6

See more details on using hashes here.

File details

Details for the file fugashi-0.1.10-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

  • Download URL: fugashi-0.1.10-cp35-cp35m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 465.0 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.10-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 baa48321caedf34f58a94cb4fbb8d0972f86084688d5af3b46e5f69902e272a4
MD5 92f629a0c26ccc6c94b20aacefeb4ca6
BLAKE2b-256 b4cb5f3e83a9d5084c70e4abc8de61adfed4f535521d32c6af1777e9f5b36e20

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