Skip to content

Commit

Permalink
refactor/adjust scores (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl authored Jan 13, 2024
1 parent 51c42d3 commit 5a9f7ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ dist

# Created by unit tests
.pytest_cache/
/.gtm/
7 changes: 4 additions & 3 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def CQS_match_query_phrase(self, phrase):
summary = self.ask_the_duck(sess)
if summary:
self.log.info(f"DDG answer: {summary}")
return (phrase, CQSMatchLevel.GENERAL, summary,
return (phrase, CQSMatchLevel.CATEGORY, summary,
{'query': phrase,
'answer': summary})

Expand All @@ -283,10 +283,11 @@ def ask_the_duck(self, sess):
DuckDuckGoSolver.enable_tx = True

query = self.session_results[sess.session_id]["query"]
self.set_context("DuckKnows", query)
results = self.duck.long_answer(query, lang=sess.lang)
self.session_results[sess.session_id]["results"] = results
return results[0]["summary"]
if results:
self.set_context("DuckKnows", query)
return results[0]["summary"]

def display_ddg(self, sess: Session):
if not can_use_gui(self.bus):
Expand Down

0 comments on commit 5a9f7ac

Please sign in to comment.