Dodanie makiety analizatora języka naturalnego
This commit is contained in:
parent
cc74e9e838
commit
aa1b9cf66b
18
src/service/NaturalLanguageUnderstanding.py
Normal file
18
src/service/NaturalLanguageUnderstanding.py
Normal file
@ -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 frame == "":
|
||||||
|
if(word in self.dictionary):
|
||||||
|
frame+=self.dictionary[word]
|
||||||
|
else:
|
||||||
|
if(word in self.dictionary):
|
||||||
|
frame+="&"+self.dictionary[word]
|
||||||
|
return frame
|
Loading…
Reference in New Issue
Block a user