First of all, it seems that I do not understand from the title, but the trigger was when I was looking for python mode of Processing. There are many people who make Python Mode, but I often look at the Website of the person who created Python Mode that appears in the official module list of Processing. It was. Then he was making something called Haiku Finder. That's why I touched it. By the way, haiku seems to count the number of syllables in English.
It's just as usual.
$ wget http://MrFeinberg.com/haikufinder-1.1.zip
$ unzip haikufinder-1.1.zip
$ cd haikufinder-1.1
$ python setup.py install
After that, you can write a script like the one in the README. .. .. .. .. .. .. .. .. It was supposed to be, but first we have to find a document that has a syllable sequence of 5 7 5
.
I managed to find this by wandering around. This is Cinderella (laughs)
So it looks like this.
haiku_test.py
from haikufinder import HaikuFinder
text = ''' Once there was a gentleman who married, for his
second wife, the proudest and most haughty woman that
was ever seen. She had, by a former husband, two
daughters of her own humor, who were, ..(Omitted because it is long)'''
haikus = HaikuFinder(text).find_haikus()
for haiku in haikus:
print haiku[0]
print " %s" % haiku[1]
print haiku[2]
print
Prepare such a script, place it under haikufinder-1.1 /
, and execute it. The result is like this.
$ python haiku_test.py
Nothing was then heard
but a confused noise of: "Ha!
how handsome she is!
is. Only this. For the time being, you can get a phrase with a good rhythm.
5 7 5
CountIs it? I think there are tools that can be separated by clauses rather than morphemes, but I haven't investigated them in detail. I think that mecab's morphological analysis seems to use the minimum number of clauses heuristically. Then.
Recommended Posts