Skip to content

Commit

Permalink
Ensure contractions learn correctly.
Browse files Browse the repository at this point in the history
By tokenizing sentences instead of splitting by spaces. See #29.
  • Loading branch information
tomaarsen committed Nov 7, 2022
1 parent 5238492 commit 4c33740
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion MarkovChainBot.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def message_handler(self, m: Message):

for sentence in sentences:
# Get all seperate words
words = sentence.split(" ")
words = tokenize(sentence)
# Double spaces will lead to invalid rules. We remove empty words here
if "" in words:
words = [word for word in words if word]
Expand Down

0 comments on commit 4c33740

Please sign in to comment.