raannakasturi commited on
Commit
c072563
·
1 Parent(s): 2bf3be5

Refactor text handling in fix_text function and simplify title escaping in paper_data function

Browse files
Files changed (1) hide show
  1. main.py +4 -4
main.py CHANGED
@@ -19,7 +19,7 @@ def fix_text(text):
19
  fixed_text += word.encode('latin1').decode('utf-8')+" "
20
  except:
21
  fixed_text += word+" "
22
- return fixed_text.encode('utf-8').decode().replace("\n", "\\n").replace("\\n", "\\\\n").replace('\\', '\\\\')
23
 
24
  def paper_data(paper_data, wait_time=5):
25
  data = {"status": "success"}
@@ -32,7 +32,7 @@ def paper_data(paper_data, wait_time=5):
32
  doi = details.get("doi")
33
  pdf_url = details.get("pdf_url")
34
  title = details.get("title")
35
- title = html.escape(title.encode('unicode-escape').decode().replace('\\\\', '\\'))
36
  citation = details.get("citation")
37
  if not all([paper_id, doi, pdf_url, title, citation]):
38
  print(f"Skipping paper with ID: {paper_id} (missing details)")
@@ -100,8 +100,8 @@ def test(uaccess_key):
100
  "Economics": {
101
  "2501.00578":{
102
  "paper_id":"2501.00578",
103
- "doi":"https://doi.org/10.48550/arXiv.2501.00578",
104
- "title":"The Limits of Tolerance",
105
  "category":"Economics",
106
  "pdf_url":"https://arxiv.org/pdf/2501.00578",
107
  "citation":"Miller, A. D. (2025). The limits of tolerance (Version 1). arXiv. https://doi.org/10.48550/ARXIV.2501.00578",
 
19
  fixed_text += word.encode('latin1').decode('utf-8')+" "
20
  except:
21
  fixed_text += word+" "
22
+ return fixed_text.encode('utf-8').decode()
23
 
24
  def paper_data(paper_data, wait_time=5):
25
  data = {"status": "success"}
 
32
  doi = details.get("doi")
33
  pdf_url = details.get("pdf_url")
34
  title = details.get("title")
35
+ title = html.escape(title)
36
  citation = details.get("citation")
37
  if not all([paper_id, doi, pdf_url, title, citation]):
38
  print(f"Skipping paper with ID: {paper_id} (missing details)")
 
100
  "Economics": {
101
  "2501.00578":{
102
  "paper_id":"2501.00578",
103
+ "doi":"https://doi.org/10.1002/alz.14328",
104
+ "title":"Bound-State Beta Decay of $\\mathbf{\\mathrm{^{205}{Tl}^{81+}}}$ Ions and the LOREX Project",
105
  "category":"Economics",
106
  "pdf_url":"https://arxiv.org/pdf/2501.00578",
107
  "citation":"Miller, A. D. (2025). The limits of tolerance (Version 1). arXiv. https://doi.org/10.48550/ARXIV.2501.00578",