mirror of
https://github.com/thewesker/iron_ebooks.git
synced 2025-12-20 04:11:12 -05:00
Handle curly apostrophe correctly
This commit is contained in:
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user