aliasgerovs commited on
Commit
c7ad932
1 Parent(s): 1fe725a

Uptdated colors.

Browse files
Files changed (1) hide show
  1. app.py +17 -14
app.py CHANGED
@@ -55,7 +55,6 @@ def plagiarism_check(
55
  api_key = "AIzaSyCS1WQDMl1IMjaXtwSd_2rA195-Yc4psQE"
56
  api_key = "AIzaSyCB61O70B8AC3l5Kk3KMoLb6DN37B7nqIk"
57
  api_key = "AIzaSyCg1IbevcTAXAPYeYreps6wYWDbU0Kz8tg"
58
- # api_key = "AIzaSyBrx_pgb6A64wPFQXSGQRgGtukoxVV_0Fk"
59
  cse_id = "851813e81162b4ed4"
60
 
61
  sentences = getSentences(input)
@@ -80,8 +79,7 @@ def plagiarism_check(
80
  cse_id,
81
  )
82
  print("Number of URLs: ", len(urlCount))
83
- # print("Old Score Array:\n")
84
- # print2D(ScoreArray)
85
 
86
  # Scrape URLs in list
87
  formatted_tokens = []
@@ -142,8 +140,19 @@ def plagiarism_check(
142
 
143
  index = np.unique(sentenceToMaxURL)
144
 
 
 
 
 
 
 
 
 
 
 
 
145
  urlMap = {}
146
- for count, i in enumerate(index):
147
  urlMap[i] = count + 1
148
  for i, sent in enumerate(sentences):
149
  formatted_tokens.append(
@@ -154,16 +163,10 @@ def plagiarism_check(
154
  formatted_tokens.append(("\n", None))
155
  formatted_tokens.append(("\n", None))
156
 
157
- urlScore = {}
158
- for url in index:
159
- s = [
160
- ScoreArray[url][sen]
161
- for sen in range(len(sentences))
162
- if sentenceToMaxURL[sen] == url
163
- ]
164
- urlScore[url] = sum(s) / len(s)
165
-
166
- for ind in index:
167
  formatted_tokens.append(
168
  (
169
  urlList[ind] + " --- Matching Score: " + f"{str(round(urlScore[ind] * 100, 2))}%",
 
55
  api_key = "AIzaSyCS1WQDMl1IMjaXtwSd_2rA195-Yc4psQE"
56
  api_key = "AIzaSyCB61O70B8AC3l5Kk3KMoLb6DN37B7nqIk"
57
  api_key = "AIzaSyCg1IbevcTAXAPYeYreps6wYWDbU0Kz8tg"
 
58
  cse_id = "851813e81162b4ed4"
59
 
60
  sentences = getSentences(input)
 
79
  cse_id,
80
  )
81
  print("Number of URLs: ", len(urlCount))
82
+ print(urlList)
 
83
 
84
  # Scrape URLs in list
85
  formatted_tokens = []
 
140
 
141
  index = np.unique(sentenceToMaxURL)
142
 
143
+ urlScore = {}
144
+ for url in index:
145
+ s = [
146
+ ScoreArray[url][sen]
147
+ for sen in range(len(sentences))
148
+ if sentenceToMaxURL[sen] == url
149
+ ]
150
+ urlScore[url] = sum(s) / len(s)
151
+
152
+ index_descending = sorted(urlScore, key=urlScore.get, reverse=True)
153
+
154
  urlMap = {}
155
+ for count, i in enumerate(index_descending):
156
  urlMap[i] = count + 1
157
  for i, sent in enumerate(sentences):
158
  formatted_tokens.append(
 
163
  formatted_tokens.append(("\n", None))
164
  formatted_tokens.append(("\n", None))
165
 
166
+ print(formatted_tokens)
167
+ print(index_descending)
168
+
169
+ for ind in index_descending:
 
 
 
 
 
 
170
  formatted_tokens.append(
171
  (
172
  urlList[ind] + " --- Matching Score: " + f"{str(round(urlScore[ind] * 100, 2))}%",