Update app.py
Browse files
app.py
CHANGED
@@ -263,10 +263,18 @@ def highlight_issues_in_pdf(file, language_matches: List[Dict[str, Any]]) -> byt
|
|
263 |
concatenated_text = " ".join([w[1] for w in word_list])
|
264 |
# print(f"Concatenated text length: {concatenated_text} characters.")
|
265 |
|
|
|
|
|
|
|
|
|
266 |
# Iterate over each language issue
|
267 |
for idx, issue in enumerate(language_matches, start=1):
|
268 |
offset = issue["offset"] # offset+line_no-1
|
269 |
length = issue["length"]
|
|
|
|
|
|
|
|
|
270 |
|
271 |
|
272 |
error_text = concatenated_text[offset:offset+length+1]
|
@@ -327,6 +335,9 @@ def highlight_issues_in_pdf(file, language_matches: List[Dict[str, Any]]) -> byt
|
|
327 |
print(f"Error in highlighting PDF: {e}")
|
328 |
return b""
|
329 |
|
|
|
|
|
|
|
330 |
# ------------------------------
|
331 |
# Main Analysis Function
|
332 |
# ------------------------------
|
|
|
263 |
concatenated_text = " ".join([w[1] for w in word_list])
|
264 |
# print(f"Concatenated text length: {concatenated_text} characters.")
|
265 |
|
266 |
+
# Find "References" section and exclude from processing
|
267 |
+
references_start = concatenated_text.lower().find("references")
|
268 |
+
references_offset = len(concatenated_text) if references_start == -1 else references_start
|
269 |
+
|
270 |
# Iterate over each language issue
|
271 |
for idx, issue in enumerate(language_matches, start=1):
|
272 |
offset = issue["offset"] # offset+line_no-1
|
273 |
length = issue["length"]
|
274 |
+
|
275 |
+
# Skip issues in the references section
|
276 |
+
if offset >= references_offset:
|
277 |
+
continue
|
278 |
|
279 |
|
280 |
error_text = concatenated_text[offset:offset+length+1]
|
|
|
335 |
print(f"Error in highlighting PDF: {e}")
|
336 |
return b""
|
337 |
|
338 |
+
|
339 |
+
|
340 |
+
|
341 |
# ------------------------------
|
342 |
# Main Analysis Function
|
343 |
# ------------------------------
|