This is one of the most interesting little projects I’ve done recently. I got to apply some of my interest in randomly generated content to a real marketing purpose. The Scoop Away brand is whimsical, which offered a great opportunity to build a complex engine for recommending cat names. The stakes were low as far as making recommendations. After all, it’s hard to argue definitively about the right name for a cat. Regardless, I built a system that allowed non-technical folks work their creative magic and mixed in some rules to make it seem like a very scientific name generate that produces consistent results. That is, if you answer the questions the same way, you will get the same results.
Configuration for the generator is done through two CSV files, one that outlines all questions and answers and one that contains all the recommended names. The first file has one row per question. After the text of the question, pairs of columns contain the answer text and an answer image filename. For example, the first question is as follows.
|gender||What gender cat are you naming?||Male||male.png||Female||female.png|
The second file lists one name per row with the text answers in following columns. A truncated example row follows.
We have the name “Ace” as suggested for female cats with primarily brown fur (among ten other dimensions). This second CSV file is a big matrix that allows me to match an input set of answers to sort all the names based on how many answers match. All questions are treated with equal weight. This does produce some times. The tie-breaker is a pseudo-random number seeded by the current month number. This produces the same results for the same answers for a span of a month. Next month, the answers will be in a different order. A year later, the order will be same again.
One key piece that made this possible was a jQuery plugin for reading CSV files. I found Evan Plaice’s jquery-csv on google code. The docs are great and it was easy to get it going.
I implemented the generator as a jquery plugin itself. You can check out the code here: http://www.scoopaway.com/js/pages/cat-name-generator.js. Next, I hope to adapt this technique for a more serious product selector. Hopefully that exercises the code in way that shakes out any bugs in the logic.