FIX: Naming convention
This commit is contained in:
parent
2efe4b2d79
commit
41ef6bfded
28
Modules.py
28
Modules.py
@ -9,7 +9,7 @@ class NLU:
|
|||||||
#Turn text into frame
|
#Turn text into frame
|
||||||
#return vector for further use
|
#return vector for further use
|
||||||
|
|
||||||
act = "(greetings()&request(name))"
|
act = "(hello()&request(name))"
|
||||||
vector = [[0],[1,0]]
|
vector = [[0],[1,0]]
|
||||||
return vector
|
return vector
|
||||||
|
|
||||||
@ -21,8 +21,8 @@ class DP:
|
|||||||
self.arguments = arguments
|
self.arguments = arguments
|
||||||
|
|
||||||
def tacticChoice(self, frame_list):
|
def tacticChoice(self, frame_list):
|
||||||
act_vector = [0, 0]
|
actVector = [0, 0]
|
||||||
return act_vector
|
return actVector
|
||||||
|
|
||||||
#Dialogue State Tracker
|
#Dialogue State Tracker
|
||||||
class DST:
|
class DST:
|
||||||
@ -30,29 +30,31 @@ class DST:
|
|||||||
def __init__(self, acts, arguments):
|
def __init__(self, acts, arguments):
|
||||||
self.acts = acts
|
self.acts = acts
|
||||||
self.arguments = arguments
|
self.arguments = arguments
|
||||||
self.frame_list= []
|
self.frameList= []
|
||||||
|
|
||||||
#store new act into frame
|
#store new act into frame
|
||||||
def store(self, frame):
|
def store(self, frame):
|
||||||
self.frame_list.append(frame)
|
self.frameList.append(frame)
|
||||||
|
|
||||||
def transfer(self):
|
def transfer(self):
|
||||||
return self.frame_list
|
return self.frameList
|
||||||
#Natural Language Generator
|
#Natural Language Generator
|
||||||
class NLG:
|
class NLG:
|
||||||
def __init__(self, acts, arguments):
|
def __init__(self, acts, arguments):
|
||||||
self.acts = acts
|
self.acts = acts
|
||||||
self.arguments = arguments
|
self.arguments = arguments
|
||||||
|
|
||||||
def vectorToText(self, act_vector):
|
def vectorToText(self, actVector):
|
||||||
if(act_vector == [0, 0]):
|
if(actVector == [0, 0]):
|
||||||
return "Cześć, mam na imię Mateusz"
|
return "Witaj, nazywam się Mateusz."
|
||||||
return "Nie rozumiem Cię"
|
else:
|
||||||
|
return "Przykro mi, nie zrozumiałem Cię"
|
||||||
|
|
||||||
|
|
||||||
class Run:
|
class Run:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.acts={
|
self.acts={
|
||||||
0: "greetings",
|
0: "hello",
|
||||||
1: "request",
|
1: "request",
|
||||||
}
|
}
|
||||||
self.arguments={
|
self.arguments={
|
||||||
@ -64,7 +66,7 @@ class Run:
|
|||||||
self.nlg = NLG(self.acts, self.arguments)
|
self.nlg = NLG(self.acts, self.arguments)
|
||||||
self.dst = DST(self.acts, self.arguments)
|
self.dst = DST(self.acts, self.arguments)
|
||||||
|
|
||||||
def process(self, command):
|
def inputProcessing(self, command):
|
||||||
act = self.nlu.analyze(command)
|
act = self.nlu.analyze(command)
|
||||||
|
|
||||||
self.dst.store(act)
|
self.dst.store(act)
|
||||||
@ -76,7 +78,7 @@ class Run:
|
|||||||
run = Run()
|
run = Run()
|
||||||
while(1):
|
while(1):
|
||||||
message = input("Napisz coś: ")
|
message = input("Napisz coś: ")
|
||||||
print(run.process(message))
|
print(run.inputProcessing(message))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user