This commit is contained in:
ahmed531998 2023-04-20 01:41:21 +02:00
parent 35dfb21bf4
commit 93d36c7cc8
3 changed files with 5 additions and 2 deletions

2
NLU.py
View File

@ -88,7 +88,7 @@ class NLU:
"""
Query -> coref resolution & intent extraction -> if intents are not confident or if query is ambig -> rewrite query and recheck -> if still ambig, ask a clarifying question
"""
if utterance in ["help", "list resources", "list papers", "list datasets", "list topics"]:
if utterance.lower() in ["help", "list resources", "list papers", "list datasets", "list topics"]:
return {"modified_query": utterance, "intent": "COMMAND", "entities": [], "is_offensive": False, "is_clear": True}
self.to_process = utterance

View File

@ -255,7 +255,7 @@ class ResponseGenerator:
return self.gen_response(action="listCommands")
elif action == "sumPaper":
if len(self.paper) == 0 or (len(self.paper) > 0 and len(state['entities'])>0)
if len(self.paper) == 0 or (len(self.paper) > 0 and len(state['entities'])>0):
for entity in state['entities']:
if (entity['entity'] == 'TITLE'):
paper = self._get_matching_titles('paper_db', entity['value'])

View File

@ -159,6 +159,7 @@ def feedback():
data['speed'], data['intent']))
conn.commit()
cur.close()
reply = jsonify({"status": "done"})
return reply
@ -198,6 +199,7 @@ if __name__ == "__main__":
threading.Thread(target=vre_fetch, name='updatevre').start()
threading.Thread(target=clear_inactive, name='clear').start()
conn = psycopg2.connect(host="janet-pg", database=os.getenv("POSTGRES_DB"), user=os.getenv("POSTGRES_USER"), password=os.getenv("POSTGRES_PASSWORD"))
cur = conn.cursor()
@ -219,4 +221,5 @@ if __name__ == "__main__":
)
conn.commit()
cur.close()
app.run(host='0.0.0.0')