Dodanie makiety analizatora języka naturalnego
This commit is contained in:
parent
cc74e9e838
commit
cec4f7da50
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(word in self.dictionary):
|
||||||
|
frame+=self.dictionary[word]+"&"
|
||||||
|
return frame[0:-1]
|
||||||
|
|
||||||
|
|
||||||
|
naturalLanguageUnderstanding = NaturalLanguageUnderstanding()
|
||||||
|
print(naturalLanguageUnderstanding.convertTextToFrame("Cześć, jak masz na imię?"))
|
Loading…
Reference in New Issue
Block a user