chat-restaruacja/src/service/natural_languag_understanding.py

15 lines
377 B
Python

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]