lib/lita/handlers/markov/engine.rb in lita-markov-1.1.1 vs lib/lita/handlers/markov/engine.rb in lita-markov-1.1.2
- old
+ new
@@ -32,10 +32,10 @@
# string - String of words that the user has just said (ideally a sentence)
def ingest user, string
string = sanitize_string string
words = separate_string string
- return if words.length == 0
+ return if words.length < @depth
# Capitalize the first word and add a period at the end
words = [words[0].capitalize] + words.slice(1..-1) + ['.']
# Iterate over it one step at a time in sets of `@depth + 1`