starfriend commited on
Commit
88bc2d3
·
verified ·
1 Parent(s): efb00d7

Upload public_routes.py

Browse files
backend/media_analysis/public_routes.py CHANGED
@@ -31,6 +31,10 @@ def _public_answer_text(answer):
31
  "", answer, flags=re.I)
32
  # Other formats of the same internal metadata are not useful to a reader.
33
  answer = re.sub(r"\bpaper\s+\d+\s*[,;]\s*label\s+(?:table|figure|fig)[_.-]0*\d+\b", "", answer, flags=re.I)
 
 
 
 
34
  return answer
35
 
36
  def _enabled():
 
31
  "", answer, flags=re.I)
32
  # Other formats of the same internal metadata are not useful to a reader.
33
  answer = re.sub(r"\bpaper\s+\d+\s*[,;]\s*label\s+(?:table|figure|fig)[_.-]0*\d+\b", "", answer, flags=re.I)
34
+ # Some models echo structured citation metadata in prose instead of using
35
+ # the separately returned provenance record (e.g. Source 1; paper_id=...).
36
+ answer = re.sub(r"\(\s*Source\s*\d+\s*;?\s*paper_id\s*=\s*[^);\s]+\s*;?\s*label\s*=\s*[^)]+\)", "", answer, flags=re.I)
37
+ answer = re.sub(r"\bSource\s*\d+\s*;\s*paper_id\s*=\s*[^;\s]+\s*;\s*label\s*=\s*(?:table|figure|fig)[_.-]0*\d+\b", "", answer, flags=re.I)
38
  return answer
39
 
40
  def _enabled():