Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -50,11 +50,15 @@ async def server_1():
|
|
50 |
# check docs first then check similarity
|
51 |
query_sentence = "Obama's first name"
|
52 |
duck_results = []
|
|
|
53 |
try:
|
54 |
searchduck = DuckDuckGoSearchResults(output_format="list", max_results=5, num_results=5)
|
55 |
duck_results = searchduck.invoke(query_sentence)
|
|
|
56 |
except:
|
57 |
-
|
|
|
|
|
58 |
|
59 |
|
60 |
tool = Tool(
|
@@ -62,18 +66,25 @@ async def server_1():
|
|
62 |
description="Search Google for recent results.",
|
63 |
func=search.run,
|
64 |
)
|
65 |
-
|
66 |
google_results = search.results( query_sentence , 10 )
|
67 |
-
print("type(duck_results)") ; print(type(duck_results)) ; print(type(google_results)
|
68 |
-
all_results =
|
69 |
-
|
|
|
|
|
70 |
# get the snippet put into list
|
71 |
split_query_words = query_sentence.split(); important_keywords = []
|
72 |
for x in split_query_words:
|
73 |
if x.isupper():
|
74 |
important_keywords.append(x)
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
-
|
77 |
# res = "" ; iteratorx = 0
|
78 |
# for word in split_query_words:
|
79 |
# if len(word) > len(res):
|
|
|
50 |
# check docs first then check similarity
|
51 |
query_sentence = "Obama's first name"
|
52 |
duck_results = []
|
53 |
+
all_results = []
|
54 |
try:
|
55 |
searchduck = DuckDuckGoSearchResults(output_format="list", max_results=5, num_results=5)
|
56 |
duck_results = searchduck.invoke(query_sentence)
|
57 |
+
all_results = duck_results
|
58 |
except:
|
59 |
+
print("An exception occurred")
|
60 |
+
duck_results = []
|
61 |
+
|
62 |
|
63 |
|
64 |
tool = Tool(
|
|
|
66 |
description="Search Google for recent results.",
|
67 |
func=search.run,
|
68 |
)
|
69 |
+
try:
|
70 |
google_results = search.results( query_sentence , 10 )
|
71 |
+
print("type(duck_results)") ; print(type(duck_results)) ; print(type(google_results)
|
72 |
+
all_results = all_results + google_results
|
73 |
+
except:
|
74 |
+
print("An exception occurred")
|
75 |
+
|
76 |
# get the snippet put into list
|
77 |
split_query_words = query_sentence.split(); important_keywords = []
|
78 |
for x in split_query_words:
|
79 |
if x.isupper():
|
80 |
important_keywords.append(x)
|
81 |
+
if len(x) > 3 & x.isupper() == False:
|
82 |
+
important_keywords.append(x)
|
83 |
+
|
84 |
+
# pull pages and split each html and count occurance of important keywords here & check snipp if snipp occurs between . and <p> its good not img
|
85 |
+
#
|
86 |
|
87 |
+
# get the longest word in sentence
|
88 |
# res = "" ; iteratorx = 0
|
89 |
# for word in split_query_words:
|
90 |
# if len(word) > len(res):
|