Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -92,8 +92,8 @@ async def server_1():
|
|
| 92 |
split_query_words = query_sentence.split(); important_keywords = []; uppercased_keywords = [];
|
| 93 |
for x in split_query_words:
|
| 94 |
print(" x.isupper() ")
|
| 95 |
-
print(x)
|
| 96 |
-
print( x[0].isupper() )
|
| 97 |
if x[0].isupper() == True :
|
| 98 |
uppercased_keywords.append(x)
|
| 99 |
if ( len(x) > 3 ) & ( x[0].isupper() == False ):
|
|
@@ -107,16 +107,16 @@ async def server_1():
|
|
| 107 |
snipp_score = 0
|
| 108 |
capitalized_score = 0
|
| 109 |
for words in important_keywords:
|
| 110 |
-
print("The important words " )
|
| 111 |
-
print(words)
|
| 112 |
-
print("x[snippet].find(words)")
|
| 113 |
# print(x["snippet"].find(words))
|
| 114 |
if x["snippet"].find(words) != -1 :
|
| 115 |
-
print("Found word")
|
| 116 |
snipp_score = snipp_score + 1
|
| 117 |
for words in uppercased_keywords:
|
| 118 |
-
print("The important words capitalized" )
|
| 119 |
-
print(words)
|
| 120 |
if x["snippet"].find(words) != -1 :
|
| 121 |
snipp_score = snipp_score + 1
|
| 122 |
capitalized_score = capitalized_score + 1
|
|
@@ -137,9 +137,9 @@ async def server_1():
|
|
| 137 |
# print("important keywords")
|
| 138 |
# print(important_keywords)
|
| 139 |
# print("capitalized_score")
|
| 140 |
-
print(capitalized_score)
|
| 141 |
-
print("snipp_score")
|
| 142 |
-
print(snipp_score)
|
| 143 |
|
| 144 |
print("these are new_results")
|
| 145 |
print("===============================")
|
|
@@ -161,7 +161,7 @@ async def server_1():
|
|
| 161 |
for x in new_results:
|
| 162 |
n_results[iter_x] = []
|
| 163 |
print("x[snippet]")
|
| 164 |
-
print(x["snippet"])
|
| 165 |
for y in (x["snippet"]).split('.') :
|
| 166 |
score = 0 ; cap_score = 0 ;
|
| 167 |
for words in important_keywords :
|
|
@@ -179,8 +179,8 @@ async def server_1():
|
|
| 179 |
if ( score >= ( len(important_keywords)-1 ) ) or ( cap_score >= len(uppercased_keywords) and (len(uppercased_keywords) > 0) ):
|
| 180 |
n_results[iter_x].append(y)
|
| 181 |
iter_x = iter_x + 1
|
| 182 |
-
print("iterator")
|
| 183 |
-
print(iter_x)
|
| 184 |
|
| 185 |
print("n_results length")
|
| 186 |
print(len(n_results))
|
|
@@ -425,6 +425,7 @@ def process_similarity_15(sorted0, sorted1, sorted2, sorted3, actualscore0, actu
|
|
| 425 |
if __name__ == '__main__':
|
| 426 |
|
| 427 |
app.run(host='0.0.0.0', port=8081)
|
| 428 |
-
|
| 429 |
server_app()
|
|
|
|
| 430 |
|
|
|
|
| 92 |
split_query_words = query_sentence.split(); important_keywords = []; uppercased_keywords = [];
|
| 93 |
for x in split_query_words:
|
| 94 |
print(" x.isupper() ")
|
| 95 |
+
# print(x)
|
| 96 |
+
# print( x[0].isupper() )
|
| 97 |
if x[0].isupper() == True :
|
| 98 |
uppercased_keywords.append(x)
|
| 99 |
if ( len(x) > 3 ) & ( x[0].isupper() == False ):
|
|
|
|
| 107 |
snipp_score = 0
|
| 108 |
capitalized_score = 0
|
| 109 |
for words in important_keywords:
|
| 110 |
+
# print("The important words " )
|
| 111 |
+
# print(words)
|
| 112 |
+
# print("x[snippet].find(words)")
|
| 113 |
# print(x["snippet"].find(words))
|
| 114 |
if x["snippet"].find(words) != -1 :
|
| 115 |
+
# print("Found word")
|
| 116 |
snipp_score = snipp_score + 1
|
| 117 |
for words in uppercased_keywords:
|
| 118 |
+
# print("The important words capitalized" )
|
| 119 |
+
# print(words)
|
| 120 |
if x["snippet"].find(words) != -1 :
|
| 121 |
snipp_score = snipp_score + 1
|
| 122 |
capitalized_score = capitalized_score + 1
|
|
|
|
| 137 |
# print("important keywords")
|
| 138 |
# print(important_keywords)
|
| 139 |
# print("capitalized_score")
|
| 140 |
+
# print(capitalized_score)
|
| 141 |
+
# print("snipp_score")
|
| 142 |
+
# print(snipp_score)
|
| 143 |
|
| 144 |
print("these are new_results")
|
| 145 |
print("===============================")
|
|
|
|
| 161 |
for x in new_results:
|
| 162 |
n_results[iter_x] = []
|
| 163 |
print("x[snippet]")
|
| 164 |
+
# print(x["snippet"])
|
| 165 |
for y in (x["snippet"]).split('.') :
|
| 166 |
score = 0 ; cap_score = 0 ;
|
| 167 |
for words in important_keywords :
|
|
|
|
| 179 |
if ( score >= ( len(important_keywords)-1 ) ) or ( cap_score >= len(uppercased_keywords) and (len(uppercased_keywords) > 0) ):
|
| 180 |
n_results[iter_x].append(y)
|
| 181 |
iter_x = iter_x + 1
|
| 182 |
+
# print("iterator")
|
| 183 |
+
# print(iter_x)
|
| 184 |
|
| 185 |
print("n_results length")
|
| 186 |
print(len(n_results))
|
|
|
|
| 425 |
if __name__ == '__main__':
|
| 426 |
|
| 427 |
app.run(host='0.0.0.0', port=8081)
|
| 428 |
+
|
| 429 |
server_app()
|
| 430 |
+
time.sleep(4)
|
| 431 |
|