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.9.tar.gz (73.8 kB view details)

Uploaded Source

Built Distributions

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

Uploaded CPython 3.12 Windows x86-64

kytea-0.1.9-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.9-cp312-cp312-macosx_11_0_arm64.whl (719.6 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

kytea-0.1.9-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.9-cp311-cp311-win_amd64.whl (318.4 kB view details)

Uploaded CPython 3.11 Windows x86-64

kytea-0.1.9-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.9-cp311-cp311-macosx_11_0_arm64.whl (718.8 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

kytea-0.1.9-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.9-cp310-cp310-win_amd64.whl (318.4 kB view details)

Uploaded CPython 3.10 Windows x86-64

kytea-0.1.9-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.9-cp310-cp310-macosx_11_0_arm64.whl (718.9 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

kytea-0.1.9-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.9-cp39-cp39-win_amd64.whl (318.4 kB view details)

Uploaded CPython 3.9 Windows x86-64

kytea-0.1.9-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.9-cp39-cp39-macosx_11_0_arm64.whl (718.8 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

kytea-0.1.9-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.9-cp38-cp38-win_amd64.whl (318.4 kB view details)

Uploaded CPython 3.8 Windows x86-64

kytea-0.1.9-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.9-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.9.tar.gz.

File metadata

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

File hashes

Hashes for kytea-0.1.9.tar.gz
Algorithm Hash digest
SHA256 5fa4adcbfef89d2001209eb8bdda9da2e97fa41932371fa959b1df5a51cdeffb
MD5 6600184b62c34182a8005c74e1f63cc4
BLAKE2b-256 bd923a987ebc15180fdc8f69bf774ea9007e8f063949b229a432524e5aeed019

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for kytea-0.1.9-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d70f0842e18fb4843d8fed4ac205b8ab0a68fe2e956022e793f052c0de71da88
MD5 cab693c3326786d3a7e2b61556896e77
BLAKE2b-256 3a25f8d1f0d4b82f5b84ce30d9ff94c37f9f19c4d0508661d178c4d8571ea447

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 74306286b07a8edbf2dd241b432c5ccd5dd3b53d8bf3562e4c79f78cb1d65451
MD5 eed00d29dec296bf76c80926681a8691
BLAKE2b-256 033a7a5dca364fd7e0e5988b4264b1708292050ed7c0916336032f306d2928e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 014cf34abac9e770a15fbd920f85bd15c32c63c1f2f0a40b76cfe8657ed55f39
MD5 92b80fab74044a56f8da138c9a9b1f62
BLAKE2b-256 ffb93aebf98bf0e59fe5a154e4562563be613f9ac776ca241c01e3622afe6eeb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 378ed3d7d3e2f0d2f5e77ae78d443dec46f56bf593ac27ff3265f130a380fdd7
MD5 29f0f54985d36a848d57bedb4c9bb0f9
BLAKE2b-256 0e13af5cf0578ba422d245fae1837d858d80d216a05bcf2373c75a764f95b374

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for kytea-0.1.9-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 23d4689686e7aaca0bd22ebb19b7fc446c78b57ee6e3d0d63dd7c6c8f67f42ba
MD5 643647751b0da16d03141e5193dca562
BLAKE2b-256 fc2c87027a748f59a182bf79a04a4aa59d1500e99c9f9a2c76bfb3abcebf1a91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 db8cb83ef686a1a0eee449181b89ef4ed135e83570f8e29b5a1b42d712a74f6a
MD5 a1361f8de863313dba24c65ea9d297d0
BLAKE2b-256 ec98744859e55f69255259eb7875d5262942030697688844743c06a08f458cd5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49eda67543990e32b9122e32c5ea81cc21236ae4282b4c5da9993468f6f88341
MD5 cbe66f02283f6cd04ed6e42ba3fff1e8
BLAKE2b-256 eac35b70cd3b742ac2e8aefd17746d967e58a512cc091fc888196f242c2d8b01

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fa207edd3902ce28256cfbbd91ede2ae710190c785dd8ccd2a6884f5b59b123b
MD5 6b32ca2239dcfd679836afffb9da6859
BLAKE2b-256 232d764b507bef505aebb9ea00a3c79a10cee1b6e633e227b01816d7394318a6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for kytea-0.1.9-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 64d4f3043ec234a779d07c177e3a6b836129cc9251eababa3e320e657f01c472
MD5 5f58995ba29a97ea3311d144b7da12d5
BLAKE2b-256 4efb3bcbf7f2c197e7bba828a680c8846bd4f350933f9d3922ec983a836b7c89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6becfbdd939cf500c7322540e3eb7c219a5a1400b9326cdfd2d1c2fc54b2425c
MD5 f2fbfbd0d27e79876548540079be4a4d
BLAKE2b-256 82db9ddf6be5e616c6c34a0d24cdbdec719a6c8129f71141f32dc935636e3e54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8ab77065bbb75e8eece79c4cc342dcf1364ea493540e46fd89c0e8123b9ea559
MD5 82dd8457d955af344650effb466f9211
BLAKE2b-256 36161a299f969d3e85ea1c0bd96f5c47f798184dfb95a42711780e71fe5b72c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 122e0665aad9f064c12df0da1f7d7be15f700d97c32be9fd7916d7bbcf454ec0
MD5 5d76b2f7c84ad2124c1d31d786018884
BLAKE2b-256 316b64118f7eefa1d94ba7599d7521e7a2a05856b5857b36a6f978c9ec9f9222

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for kytea-0.1.9-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 991f934a917e64673822cc35a43e3175626cc37e1bf3a3668691dceb1808557d
MD5 95b8f7b1479f40e407101a97d19990aa
BLAKE2b-256 564befcc276897347c7b1ca408a4a5f7cc1e575e82f3373ad818148e15d9bf45

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 342b7a1fc24f3b5ecbfe1d5fa7b77936dabd15ddf2ff806f88ecd2de379c8be4
MD5 dd0609a0e337b9849d8ef9dbb1ad2ee8
BLAKE2b-256 95caf3687403db9d44acfc46ba968518d73570cb7d7215e09d5b2f4501d8cf44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9ead57d7b1eeed812d8b966a2d36cef3fae5bd3c656720339db85b420093588c
MD5 4a54d3c37babfd0cd87813d91a1ff5a4
BLAKE2b-256 e08e06806286fa0eba34947594844ed5c56eaadaf54e162a67ee50a513467ef9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 fc9bbd8fe9c224398496ac4327961715d2d9d9aaf57a19fbd8eba20943cdc5a5
MD5 e2b94b2286097fdbf5af8cc3115c2f0b
BLAKE2b-256 c2a87fd30850a70ba0c702dc8460eb2080d256d8533774eb6a3a4afd3f45086c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for kytea-0.1.9-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 1f073948ddaf0f54831a039ef177acf5b07ca1f682fd12258a47a36a4dbb1a97
MD5 870b082ea1253f5e025c26fffb399f55
BLAKE2b-256 1dbe84380ad08f60b5f67984e44ab8217009e8fa48c0a0cc77af058cde628292

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b399c866302e5fd117db7526bd1da2f29cf1fc7cc6808a07c8b10b349fc6a878
MD5 c358dc5df1e5bccd489f0bf1fab44da7
BLAKE2b-256 551af5f345ae607085b9d71d017c37bbb21455952ba1fce8e50ec1355464873b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kytea-0.1.9-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0e3d46088ff184c16b573a222f45250fb5dfdfa352de8312d1537ef99c890cbd
MD5 c1012c5e22236c21504d0a8ee2ba8f45
BLAKE2b-256 5a304603de5e0275c023cdbb5451aba1682eb8d1f563875a1004d49d573ad0b3

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