This cleverly named bot finds haiku in the twitterverse and republishes them in a recognizable format. The program “runs on @johndburger’s laptop” and even though the code isn’t available, the basic procedure can be inferred from the results as a set of steps:
- The program uses Twitter API to pull tweets to analyze, filtering out anything that isn’t in English.
- It uses some sort of library, like the Wordnik API to identify and count the number of syllables in all the words obtaining a total for the tweet. With this procedure, it can identify tweets with exactly 17 syllables.
- It then determines which of those tweets can be divided into three lines of 5, 7, and 5 syllables without cutting into any words.
- It formats the results to add: line breaks, a ” •” symbol at the end of the first two lines (to signal line breaks for Twitter clients that don’t support them), attribution to the writer of the original tweet, and the #haiku hashtag.
- Burger then selects the best haiku or simply posts the raw results (I’m not sure), and manually post or schedules about 6 tweets per day with a 4-5 hour interval between them.