syntax_fix_new_intents
This commit is contained in:
parent
93d36c7cc8
commit
f0955da5cc
|
@ -91,7 +91,8 @@ class ResponseGenerator:
|
|||
def gen_response(self, action, utterance=None, name=None, username=None, vrename=None, state=None, consec_history=None, chitchat_history=None):
|
||||
if action == "Help":
|
||||
commands = " You can choose between using one of the supported commands to explore the environment or you can use natural language to find resourcesand get answers and summaries. \n "
|
||||
return "Hey " + name + "! it's Janet! I am here to help you make use of the datasets and papers in the catalogue of the " + vrename +" VRE. I can answer questions whose answers may be inside the papers. I can summarize papers for you. I can also chat with you. So, whichever it is, I am ready to chat!" + commands + self.gen_response(action="listCommands")
|
||||
listofcommands = self.gen_response(action="listCommands")
|
||||
return "Hey " + name + "! it's Janet! I am here to help you make use of the datasets and papers in the catalogue of the " + vrename +" VRE. I can answer questions whose answers may be inside the papers. I can summarize papers for you. I can also chat with you. So, whichever it is, I am ready to chat!" + commands + listofcommands
|
||||
elif action == "Recommend":
|
||||
prompt = self.recommender.make_recommendation(username, name)
|
||||
if prompt != "":
|
||||
|
@ -103,7 +104,7 @@ class ResponseGenerator:
|
|||
return "I am sorry, I cannot answer to this kind of language"
|
||||
elif action == "getHelp":
|
||||
commands = self.gen_response(action="listCommands")
|
||||
return "I can answer questions related to the papers in the VRE's catalogue. I can also get you the posts, papers and datasets from the catalogue if you specify a topic or an author. I am also capable of small talk and summarizing papers to an extent. Just write to me what you want and I will do it. Alternatively, you may use one of the commands Janet supports. " + commands
|
||||
return "I can answer questions related to the papers in the VRE's catalogue. I can also get you the posts, papers and datasets from the catalogue if you specify a topic or an author. I am also capable of small talk and summarizing papers to an extent. Just write to me what you want in natural language and I will try to do it. Alternatively, you may use one of the commands Janet supports. " + commands
|
||||
|
||||
elif action == "findPost":
|
||||
for entity in state['entities']:
|
||||
|
@ -211,14 +212,18 @@ class ResponseGenerator:
|
|||
return "According to the following evidence: " + evidence + " \n _______ \n " + "The answer is: " + answer
|
||||
elif action == "listPapers":
|
||||
answer = vrename + " has the following papers: \n"
|
||||
for i, pap in self.db['paper_db']:
|
||||
answer = answer + ' ' + str(i) + ') ' + pap['title'] + ': ' + pap['notes'] + ' \n '
|
||||
j = 1
|
||||
for i, pap in self.db['paper_db'].iterrows():
|
||||
answer = answer + ' ' + str(j) + ') ' + pap['title'] + ': ' + pap['notes'] + ' \n '
|
||||
j+=1
|
||||
return answer
|
||||
|
||||
elif action == "listDatasets":
|
||||
j = 1
|
||||
answer = vrename + " has the following datasets: \n"
|
||||
for i, datase in self.db['dataset_db']:
|
||||
answer = answer + ' ' + str(i) + ') ' + datase['title'] + ': ' +datase['notes'] + ' \n '
|
||||
for i, datase in self.db['dataset_db'].iterrows():
|
||||
answer = answer + ' ' + str(j) + ') ' + datase['title'] + ': ' +datase['notes'] + ' \n '
|
||||
j+=1
|
||||
return answer
|
||||
|
||||
elif action == "listCommands":
|
||||
|
@ -226,7 +231,7 @@ class ResponseGenerator:
|
|||
|
||||
elif action == "listTopics":
|
||||
topics = {}
|
||||
for i, pos in self.db['post_db']:
|
||||
for i, pos in self.db['post_db'].iterrows():
|
||||
for tag in pos['tags']:
|
||||
topics[tag] = topics[tag]+1 if tag in topics else 1
|
||||
topics = sorted(topics, reverse=True)
|
||||
|
|
1
main.py
1
main.py
|
@ -150,6 +150,7 @@ def feedback():
|
|||
print(data)
|
||||
|
||||
try:
|
||||
|
||||
conn = psycopg2.connect(host="janet-pg", database=os.getenv("POSTGRES_DB"), user=os.getenv("POSTGRES_USER"), password=os.getenv("POSTGRES_PASSWORD"))
|
||||
cur = conn.cursor()
|
||||
cur.execute('INSERT INTO feedback_experimental (query, history, janet_modified_query, is_modified_query_correct, user_modified_query, evidence_useful, response, preferred_response, response_length_feedback, response_fluency_feedback, response_truth_feedback, response_useful_feedback, response_time_feedback, response_intent) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
|
||||
|
|
Loading…
Reference in New Issue