❤️ 18790 | 🛡️ 313 | ⚔️ 825 | ⏱️ 140 | 👟 10 |
Wikipedia said:
old pond- frog leaps in- water's sound - Matsuo Bashō' | The earth shakes just enough to remind us. - Steve Sanfield | I write, erase, rewrite Erase again, and then A poppy blooms. - Katsushika Hokusai |
Example:
My files, they are there Install Windows 10 update My files, they are gone | When haiku is heard Do you count the syllables Or ponder the verse |
If I had a buck, for every dark thought I’ve had, I could afford help | I just keep scrolling Endlessly, mind numbingly Must stay distracted |
import re
# crude method of counting syllables, it's not perfect but it will cover most cases
def syllable_count(word):
exception = {'serious':3,'crucial':2}
syl_counter = 0
if word in exception:
return exception.get(word)
elif len(word) < 3:
return 1
else:
# count all the vowels first
syl_counter += len(re.findall(r'[eaoui]',word))
# hunt for Diphthong and Triphthong
for i,j in enumerate(word):
if j in "aeiou" and word[i-1] in "aeiou":
syl_counter -= 1
# if ends with "-ian", should be counted as two syllables, except for "-tian" and "-cian"
# ie. 'Canadian'
if word[-3:]== 'ian':
if word[-4:] == "cian" or word[-4:] == "tian" :
pass
else :
syl_counter += 1
if word[-1:] == 'e':
syl_counter -= 1
return syl_counter