A text analysis toolkit KyTea binding
Project description
KyTea wrapper for python
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
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
kytea-0.1.9.tar.gz
(73.8 kB
view hashes)
Built Distributions
kytea-0.1.9-cp312-cp312-win_amd64.whl
(319.0 kB
view hashes)
kytea-0.1.9-cp311-cp311-win_amd64.whl
(318.4 kB
view hashes)
kytea-0.1.9-cp310-cp310-win_amd64.whl
(318.4 kB
view hashes)
kytea-0.1.9-cp39-cp39-win_amd64.whl
(318.4 kB
view hashes)
kytea-0.1.9-cp38-cp38-win_amd64.whl
(318.4 kB
view hashes)
Close
Hashes for kytea-0.1.9-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d70f0842e18fb4843d8fed4ac205b8ab0a68fe2e956022e793f052c0de71da88 |
|
MD5 | cab693c3326786d3a7e2b61556896e77 |
|
BLAKE2b-256 | 3a25f8d1f0d4b82f5b84ce30d9ff94c37f9f19c4d0508661d178c4d8571ea447 |
Close
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 |
Close
Hashes for kytea-0.1.9-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 014cf34abac9e770a15fbd920f85bd15c32c63c1f2f0a40b76cfe8657ed55f39 |
|
MD5 | 92b80fab74044a56f8da138c9a9b1f62 |
|
BLAKE2b-256 | ffb93aebf98bf0e59fe5a154e4562563be613f9ac776ca241c01e3622afe6eeb |
Close
Hashes for kytea-0.1.9-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 378ed3d7d3e2f0d2f5e77ae78d443dec46f56bf593ac27ff3265f130a380fdd7 |
|
MD5 | 29f0f54985d36a848d57bedb4c9bb0f9 |
|
BLAKE2b-256 | 0e13af5cf0578ba422d245fae1837d858d80d216a05bcf2373c75a764f95b374 |
Close
Hashes for kytea-0.1.9-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23d4689686e7aaca0bd22ebb19b7fc446c78b57ee6e3d0d63dd7c6c8f67f42ba |
|
MD5 | 643647751b0da16d03141e5193dca562 |
|
BLAKE2b-256 | fc2c87027a748f59a182bf79a04a4aa59d1500e99c9f9a2c76bfb3abcebf1a91 |
Close
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 |
Close
Hashes for kytea-0.1.9-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49eda67543990e32b9122e32c5ea81cc21236ae4282b4c5da9993468f6f88341 |
|
MD5 | cbe66f02283f6cd04ed6e42ba3fff1e8 |
|
BLAKE2b-256 | eac35b70cd3b742ac2e8aefd17746d967e58a512cc091fc888196f242c2d8b01 |
Close
Hashes for kytea-0.1.9-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa207edd3902ce28256cfbbd91ede2ae710190c785dd8ccd2a6884f5b59b123b |
|
MD5 | 6b32ca2239dcfd679836afffb9da6859 |
|
BLAKE2b-256 | 232d764b507bef505aebb9ea00a3c79a10cee1b6e633e227b01816d7394318a6 |
Close
Hashes for kytea-0.1.9-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64d4f3043ec234a779d07c177e3a6b836129cc9251eababa3e320e657f01c472 |
|
MD5 | 5f58995ba29a97ea3311d144b7da12d5 |
|
BLAKE2b-256 | 4efb3bcbf7f2c197e7bba828a680c8846bd4f350933f9d3922ec983a836b7c89 |
Close
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 |
Close
Hashes for kytea-0.1.9-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ab77065bbb75e8eece79c4cc342dcf1364ea493540e46fd89c0e8123b9ea559 |
|
MD5 | 82dd8457d955af344650effb466f9211 |
|
BLAKE2b-256 | 36161a299f969d3e85ea1c0bd96f5c47f798184dfb95a42711780e71fe5b72c9 |
Close
Hashes for kytea-0.1.9-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 122e0665aad9f064c12df0da1f7d7be15f700d97c32be9fd7916d7bbcf454ec0 |
|
MD5 | 5d76b2f7c84ad2124c1d31d786018884 |
|
BLAKE2b-256 | 316b64118f7eefa1d94ba7599d7521e7a2a05856b5857b36a6f978c9ec9f9222 |
Close
Hashes for kytea-0.1.9-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 991f934a917e64673822cc35a43e3175626cc37e1bf3a3668691dceb1808557d |
|
MD5 | 95b8f7b1479f40e407101a97d19990aa |
|
BLAKE2b-256 | 564befcc276897347c7b1ca408a4a5f7cc1e575e82f3373ad818148e15d9bf45 |
Close
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 |
Close
Hashes for kytea-0.1.9-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ead57d7b1eeed812d8b966a2d36cef3fae5bd3c656720339db85b420093588c |
|
MD5 | 4a54d3c37babfd0cd87813d91a1ff5a4 |
|
BLAKE2b-256 | e08e06806286fa0eba34947594844ed5c56eaadaf54e162a67ee50a513467ef9 |
Close
Hashes for kytea-0.1.9-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc9bbd8fe9c224398496ac4327961715d2d9d9aaf57a19fbd8eba20943cdc5a5 |
|
MD5 | e2b94b2286097fdbf5af8cc3115c2f0b |
|
BLAKE2b-256 | c2a87fd30850a70ba0c702dc8460eb2080d256d8533774eb6a3a4afd3f45086c |
Close
Hashes for kytea-0.1.9-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f073948ddaf0f54831a039ef177acf5b07ca1f682fd12258a47a36a4dbb1a97 |
|
MD5 | 870b082ea1253f5e025c26fffb399f55 |
|
BLAKE2b-256 | 1dbe84380ad08f60b5f67984e44ab8217009e8fa48c0a0cc77af058cde628292 |
Close
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 |
Close
Hashes for kytea-0.1.9-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e3d46088ff184c16b573a222f45250fb5dfdfa352de8312d1537ef99c890cbd |
|
MD5 | c1012c5e22236c21504d0a8ee2ba8f45 |
|
BLAKE2b-256 | 5a304603de5e0275c023cdbb5451aba1682eb8d1f563875a1004d49d573ad0b3 |