Skip to content

andrew-t/deck-the-halls

Repository files navigation

deck-the-halls

Trolling the ancient Yuletide carol

This bot watched the public Twitter timeline and checks for tweets which fit the metre of Deck The Halls With Boughs Of Holly. That is, four metrical feet consisting of a stressed and an unstressed syllable.

To do this, we use a list of words mapped to their stress patterns. I use the CMU Pronouncing Dictionary, which is a wonderful resource but does mean technically the bot has a slight US accent. It also can't tell what sense a tweet means a word in which can change the stress pattern.

There are a couple of other things it filters for, including tweets that are just the same word four or eight times, or tweets where it isn't fairly clear which parts are content and which are hashtags and the like.

The gist of the code is that it turns a tweet into a string of numbers: a 0 for an unstressed beat, and a 1 (or a 2 but we don't care about the difference here) for a stressed beat. Deck the Halls is 10101010, so we test it against the regex /^([1-9]0){4}$/ to test for Deck the Hallsiness. You can configure the code to sing other songs by changing that regex.

The bot runs at @falalala_la during Christmastime.

To run, this code needs:

About

Trolling the ancient Yuletide carol

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors