markov chain generation is pretty decent

This commit is contained in:
Chris Anderson 2008-06-01 15:07:56 -07:00
parent 4be3c5f12c
commit 8ff959a6f7
20 changed files with 25066 additions and 62 deletions

View file

@ -0,0 +1,6 @@
function(doc){
var words = doc.text.split(/\W/).filter(function(w) {return w.length > 0}).map(function(w){return w.toLowerCase()});
for (var i = 0, l = words.length; i < l; i++) {
emit(words.slice(i,4),doc.title);
}
}