Discover haiku from text.
Project description
ikku
Discover haiku from text. Thanks to https://github.com/r7kamura/ikku
Requirements
- Python 3.8.x+
- MeCab with IPADIC (e.g.
brew install mecab mecab-ipadic
)
Installation
pip install ikku
Example
Reviewer is the main interface for this library.
from ikku import Reviwer
reviewer = Reviewer()
Judge if given text is valid song or not.
reviewer.judge("古池や蛙飛び込む水の音") #=> true
reviewer.judge("ああ古池や蛙飛び込む水の音ああ") #=> false
Find one valid song from given text.
reviewer.find("ああ古池や蛙飛び込む水の音ああ")
#=> <class 'ikku.song.Song'>
Search all valid songs from given text.
reviewer.search("ああ古池や蛙飛び込む水の音ああ天秤や京江戸かけて千代の春ああ")
#=> [
# [<class 'ikku.song.Song'>],
# [<class 'ikku.song.Song'>],
# ]
Return an Array of phrases of ikku.node.Node.
song.phrases #=> [["古池", "や"], ["蛙", "飛び込む"], ["水", "の", "音"]]
Pass rule
option to change the measure rule (default: [5, 7, 5]
).
reviewer = Reviewer(rule = [4, 3, 5])
reviewer.judge("古池や蛙飛び込む水の音") #=> false
reviewer.judge("すもももももももものうち") #=> true
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
ikku-0.1.3.tar.gz
(5.8 kB
view details)
Built Distribution
ikku-0.1.3-py3-none-any.whl
(6.7 kB
view details)
File details
Details for the file ikku-0.1.3.tar.gz
.
File metadata
- Download URL: ikku-0.1.3.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28d5cee95b6013cb3a82a8ef7790c0636a42d8ddbad6be3a91cae6a45a2f6fda |
|
MD5 | 5de88ca0bd3a6bad9fef6780b3323166 |
|
BLAKE2b-256 | 93f600cc0a7c820fc4e5815d69da618ef0460ed4a9bf2e715ced8d0648083ab7 |
File details
Details for the file ikku-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: ikku-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3762a964b2b6989e13e793d2c3a970074e5e408e1976bafddaaf2be9db2d0c4e |
|
MD5 | 046f91867a05220ed0ecd1c81f3097fe |
|
BLAKE2b-256 | 8a6e5084e87ed2f8010daea91ca9233264f5af193fa56bd1211e67b7e8832312 |