From 3da2fb8aad5bc14bb89cc4ed65f7f5beb3779038 Mon Sep 17 00:00:00 2001 From: Olga Kwoczak Date: Thu, 4 May 2023 16:31:38 +0200 Subject: [PATCH] add punctuation removing --- example_nlu.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/example_nlu.py b/example_nlu.py index 2265a35..54bdb87 100644 --- a/example_nlu.py +++ b/example_nlu.py @@ -34,7 +34,14 @@ def nlu(utterance): -utterance = 'jakie napoje gazowane'.lower() +utterance = 'jakie, napoje gazowane'.lower() + +punctuation = '''!;:/?,.''' + +for i in utterance: + if i in punctuation: + utterance = utterance.replace(i, "") + matched = book_grammar.find_matching_rules(utterance) print(matched)