Skip to main content

A text analysis toolkit KyTea binding

Project description

KyTea wrapper for python

Patreon

Mykytea-python is a python wrapper module for KyTea, a general text analysis toolkit. KyTea is developed by KyTea Development Team.

Detailed information of KyTea can be found at http://www.phontron.com/kytea

Install Dependencies

You need to install KyTea before build.

To install Mykytea-python, run

pip install kytea

To build Mykytea-python, run (if you don't want to use pip)

make

If you want to install, run

sudo make install

If you fail to make, please try to install SWIG and run

swig -c++ -python -I/usr/local/include mykytea.i

Or if you still fail on Max OS X, run with some variables

$ ARCHFLAGS="-arch x86_64" CC=gcc CXX=g++ make

If you compiled kytea with clang, you need ARCHFLAGS only.

Or, you can use brew to install kytea.

brew install kytea
KYTEA_DIR=$(brew --prefix) make all

How to use it?

Here is the example code to use Mykytea-python.

import Mykytea

def showTags(t):
    for word in t:
        out = word.surface + "\t"
        for t1 in word.tag:
            for t2 in t1:
                for t3 in t2:
                    out = out + "/" + str(t3)
                out += "\t"
            out += "\t"
        print(out)

def list_tags(t):
    def convert(t2):
        return (t2[0], type(t2[1]))
    return [(word.surface, [[convert(t2) for t2 in t1] for t1 in word.tag]) for word in t]

# Pass arguments for KyTea as the following:
opt = "-model /usr/local/share/kytea/model.bin"
mk = Mykytea.Mykytea(opt)

s = "今日はいい天気です。"

# Fetch segmented words
for word in mk.getWS(s):
    print(word)

# Show analysis results
print(mk.getTagsToString(s))

# Fetch first best tag
t = mk.getTags(s)
showTags(t)

# Show all tags
tt = mk.getAllTags(s)
showTags(tt)

License

MIT License

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

kytea-0.1.9a1.tar.gz (73.9 kB view details)

Uploaded Source

Built Distributions

kytea-0.1.9a1-cp312-cp312-win_amd64.whl (319.1 kB view details)

Uploaded CPython 3.12 Windows x86-64

kytea-0.1.9a1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

kytea-0.1.9a1-cp312-cp312-macosx_11_0_arm64.whl (719.6 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

kytea-0.1.9a1-cp312-cp312-macosx_10_9_x86_64.whl (735.9 kB view details)

Uploaded CPython 3.12 macOS 10.9+ x86-64

kytea-0.1.9a1-cp311-cp311-win_amd64.whl (318.4 kB view details)

Uploaded CPython 3.11 Windows x86-64

kytea-0.1.9a1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

kytea-0.1.9a1-cp311-cp311-macosx_11_0_arm64.whl (718.9 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

kytea-0.1.9a1-cp311-cp311-macosx_10_9_x86_64.whl (734.6 kB view details)

Uploaded CPython 3.11 macOS 10.9+ x86-64

kytea-0.1.9a1-cp310-cp310-win_amd64.whl (318.4 kB view details)

Uploaded CPython 3.10 Windows x86-64

kytea-0.1.9a1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

kytea-0.1.9a1-cp310-cp310-macosx_11_0_arm64.whl (718.9 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

kytea-0.1.9a1-cp310-cp310-macosx_10_9_x86_64.whl (734.6 kB view details)

Uploaded CPython 3.10 macOS 10.9+ x86-64

kytea-0.1.9a1-cp39-cp39-win_amd64.whl (318.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

kytea-0.1.9a1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

kytea-0.1.9a1-cp39-cp39-macosx_11_0_arm64.whl (718.8 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

kytea-0.1.9a1-cp39-cp39-macosx_10_9_x86_64.whl (734.6 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

kytea-0.1.9a1-cp38-cp38-win_amd64.whl (318.4 kB view details)

Uploaded CPython 3.8 Windows x86-64

kytea-0.1.9a1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.6 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

kytea-0.1.9a1-cp38-cp38-macosx_10_9_x86_64.whl (735.0 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

File details

Details for the file kytea-0.1.9a1.tar.gz.

File metadata

  • Download URL: kytea-0.1.9a1.tar.gz
  • Upload date:
  • Size: 73.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for kytea-0.1.9a1.tar.gz
Algorithm Hash digest
SHA256 f069417f94f774862b6f63b3cdbe11a1cda6c14bac1574e7f6437d0070117c31
MD5 4a273ad64c4713e89a2317cd0aa04d70
BLAKE2b-256 152ef3d3c034d7d07fbc18ecc7f1aba30999d460c3253f9202d26f8aabebf0a8

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: kytea-0.1.9a1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 319.1 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for kytea-0.1.9a1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5aa094d1415ba068af93d569505a543453edaeaca0e5e4c8cb6fde38d84b52df
MD5 48e459c6ffe25025f7d4538f14826630
BLAKE2b-256 97a62ef47ff5a2987f38ac49b510b2f9569cd9511b7a74ee696ad07a2a0862d8

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c4decf81b4376bb64c0bfc07e0110dabce1e7b8374b8fc870545d130de9bc3e9
MD5 4a2a4abde0f8ef57342b082206eb7df9
BLAKE2b-256 9e5f5458b725aec9a51c3fbc391ba0c7d657c2049d60190a68221691e7d1ad15

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8da16e256b6c89eab2283e8b85fe8d91a1a3d5415b9ccfebdee343bfa346913b
MD5 9aeea551a8d97ad9ffaa836b5baaf23e
BLAKE2b-256 a44790fd98c89568a6f2ddaf705728ecd1002033616c65a1e41df3b68c3ae7d5

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp312-cp312-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 aed594dc1a6ff29e1030b95b25209fb7d1567bc2ff8336a9c7b494e0c748ef8c
MD5 51f3493f62a4eab8e375fc17f7661f84
BLAKE2b-256 38f474defee652b0b8d151eb1e9203a1f9fc51bf779410d17ab937b1e1758ca6

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: kytea-0.1.9a1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 318.4 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for kytea-0.1.9a1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5904df098d05cc5c731953d91e106a99a6c7e6e48105d82ccf2c0106d5c7230e
MD5 82237f62883a15b27897d4b835e6d46e
BLAKE2b-256 8775af2770f92369e4d0856326f49ac89d9188d24ae0d7ef54087d488a4a724d

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b7a02d1f322e15d1339916f2d0eb5ce808bc68d7dc4c418dc61f01d90b2e8c13
MD5 2b7b030349d6d2a8121536ec695817de
BLAKE2b-256 98cc52059f146f72aa2b25cece9996606c39b9b6371a3f3c465960b72bd8bd69

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f3f615b5cd68fdde82274fdcde74ff2f8552acb5ba82e5781ad943e30b97147
MD5 374bfaafe3d750fb61542a3e3d5ecc7e
BLAKE2b-256 f858c7b68d289861f455a6d2eff4c299b971c7eb4e51dc9b1a019c6e792bb0b8

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d68ad12071eae5fccec44583bc19519ad81520599308e13b2ef133c2f8665873
MD5 095aa38d4bb777bde375d7dda54fb037
BLAKE2b-256 2f3558dc1a801da33d017d9ddda25d27e08de8646b6253ecf40d759cad56b64f

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: kytea-0.1.9a1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 318.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for kytea-0.1.9a1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5f45e9b411d3b5f31c06b101c250a8ac273fd023ec250c360c1f1e72aae4171a
MD5 75e7db3babb7c8725fd61eab3dd997b3
BLAKE2b-256 2e761db7e7cd682606fe99b260a04b22d67bc625020efa8c608e7a3e4438a01d

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1c0986b05c1ca9365f56fe254abc0f42d363a8bb0fbb229c1074216b00f84f2f
MD5 5272ea96404b79c3f15c19020ed2073a
BLAKE2b-256 c1eadbc5da2fd100433053b78e8ec9da8d40048e5615b25f1b735ab6ebe7f147

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 75e7bfd9c1d2278c2111da1029734e424ae0c91818f2922e37758ee4a0ab5fb1
MD5 f03a92e9a8eb7a6dda804b4cfeaa99be
BLAKE2b-256 1bf7d9e6e8b08e3964a8104642ab926f86d7652cc45e40f24736a173c0665c1d

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8ffd18b13fe97ebc101dd5d63640895b3138764b5e1e49ec6f6d51a83c902168
MD5 7c05b79cf88b1eb70f52e2a293fb3b21
BLAKE2b-256 17028b8af78c5d1269beecea516c2b28313abed9b9e90c79fc2a9d2dcf3cc4ef

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: kytea-0.1.9a1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 318.4 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for kytea-0.1.9a1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 4d12614bba1bc7a721950a2203a8c60a76b4342a9f74a56661e02c3bf2889e2c
MD5 d08d0a8ce643eafb575ef67c97a9d9e6
BLAKE2b-256 fbcb7dead07a251ece8f4ddb530b305f14463ce1c793992e11bba1a6ab477108

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fb32abe0846cbf19696ea1862435735d2544c40b7202366f2c205120b46cd835
MD5 29fea6d1bae7773b95557f3811f13f11
BLAKE2b-256 53b3e4c0c45bad92ef2e0bbc893ccc70415a3e7376ae324114d69bd972d2b14f

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c916ef7a97f060855d411902223ea3383d4c4ee363f5209280239cdaffaa86cc
MD5 faf6da2fc6f75b8f043a76f51c80e1b2
BLAKE2b-256 3244d742f541ed9529a698e1518b625598df85e326291d0c636a82ecee42918e

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 00954981eefc296db3718ccddf12299a6d0c31d10605481de9017b6d4d48f738
MD5 4ac9c26998b82e8fdba70339cf0271ea
BLAKE2b-256 12724cd43fa55f53ec865bf45d594e53ca1a89869cf40cb0749cc200186d76b6

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: kytea-0.1.9a1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 318.4 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for kytea-0.1.9a1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 2f25eb67e101139f49a60b7bb092ac42fcdbaa1e8b85804ff7f417d91e74ac4b
MD5 64579f56f89b03622ec3cc2a96f44522
BLAKE2b-256 933c4a3d8fef26dc2fa710805f2238849be1022f809cafa2e7ff8f35304ad7b1

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8ad754251fdcac4c17a25d3358270de9eeff8bd718e3bdf3f691f142dcbb952d
MD5 1c38d60f36f6309b4d79b561fff732db
BLAKE2b-256 4f65c88af1c89a1719e53e3158679e01057d6b98fcaa6690e7444107465cf0d6

See more details on using hashes here.

File details

Details for the file kytea-0.1.9a1-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for kytea-0.1.9a1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1c996ed3d724533621961be687bded7182004d1f22ef38817fad8c40d3b69825
MD5 b6e1443d7695eb78bac4a6bceb5ce410
BLAKE2b-256 6ce3a670c520ed1b5a26cd82b62dca6a316d8aec67890387b4ff18fce36a64c3

See more details on using hashes here.

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