Handle curly apostrophe correctly

This commit is contained in:
Jacob Harris
2013-07-11 07:49:03 -04:00
parent b0ffcc0360
commit ca71d20d80

View File

@@ -1,3 +1,5 @@
#encoding: UTF-8
class MarkovChainer
attr_reader :order
def initialize(order)
@@ -35,7 +37,7 @@ class MarkovChainer
private
def add_sentence(str, terminator)
words = str.scan(/[\w'\-]+/)
words = str.scan(/[\w'\-]+/)
return unless words.size > order # ignore short sentences
words << terminator
buf = []