raghavNCI
commited on
Commit
·
bf0cf05
1
Parent(s):
5da06ea
changes in how keywords are embedded on gnews endpoint
Browse files- question.py +3 -3
question.py
CHANGED
@@ -25,10 +25,10 @@ async def ask_question(input: QuestionInput):
|
|
25 |
question = input.question
|
26 |
|
27 |
# Extract keywords (simple version)
|
28 |
-
keywords = re.findall(r"
|
29 |
-
query_string = "
|
30 |
|
31 |
-
print("Keywords are", query_string)
|
32 |
|
33 |
gnews_url = f"https://gnews.io/api/v4/search?q={query_string}&lang=en&max=3&expand=content&token={GNEWS_API_KEY}"
|
34 |
try:
|
|
|
25 |
question = input.question
|
26 |
|
27 |
# Extract keywords (simple version)
|
28 |
+
keywords = re.findall(r"\\b\\w{4,}\\b", question)
|
29 |
+
query_string = " AND ".join(f'"{kw}"' for kw in keywords[:7])
|
30 |
|
31 |
+
print("Keywords are", query_string)
|
32 |
|
33 |
gnews_url = f"https://gnews.io/api/v4/search?q={query_string}&lang=en&max=3&expand=content&token={GNEWS_API_KEY}"
|
34 |
try:
|