From cec4f7da50ddf16c8f1869faf14ac973b17fa6af Mon Sep 17 00:00:00 2001 From: s495728 Date: Tue, 30 Apr 2024 23:08:28 +0200 Subject: [PATCH] =?UTF-8?q?Dodanie=20makiety=20analizatora=20j=C4=99zyka?= =?UTF-8?q?=20naturalnego?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/service/NaturalLanguageUnderstanding.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/service/NaturalLanguageUnderstanding.py diff --git a/src/service/NaturalLanguageUnderstanding.py b/src/service/NaturalLanguageUnderstanding.py new file mode 100644 index 0000000..96ae838 --- /dev/null +++ b/src/service/NaturalLanguageUnderstanding.py @@ -0,0 +1,18 @@ +class NaturalLanguageUnderstanding: + + dictionary = { + "Cześć," : "welcomemsg()", + "imię?" : "request(name)" + } + + def convertTextToFrame(self, text: str): + frame = "" + text = text.split(" ") + for word in text: + if(word in self.dictionary): + frame+=self.dictionary[word]+"&" + return frame[0:-1] + + +naturalLanguageUnderstanding = NaturalLanguageUnderstanding() +print(naturalLanguageUnderstanding.convertTextToFrame("Cześć, jak masz na imię?")) \ No newline at end of file