ofermend commited on
Commit
d032a15
1 Parent(s): 8038a8c

Update query.py

Browse files
Files changed (1) hide show
  1. query.py +4 -3
query.py CHANGED
@@ -43,9 +43,10 @@ class CitationNormalizer():
43
  doc_num = self.responses[response_num-1]['documentIndex']
44
  metadata = {item['name']: item['value'] for item in self.docs[doc_num]['metadata']}
45
  text = extract_between_tags(self.responses[response_num-1]['text'], start_tag, end_tag)
46
- url = f"{metadata['url']}#:~:text={quote(text)}"
47
- citation_inx = refs_dict[url]
48
- summary = summary[:start] + f'[\[{citation_inx}\]]({url})' + summary[end:]
 
49
 
50
  return summary
51
 
 
43
  doc_num = self.responses[response_num-1]['documentIndex']
44
  metadata = {item['name']: item['value'] for item in self.docs[doc_num]['metadata']}
45
  text = extract_between_tags(self.responses[response_num-1]['text'], start_tag, end_tag)
46
+ if 'url' in metadata.keys():
47
+ url = f"{metadata['url']}#:~:text={quote(text)}"
48
+ citation_inx = refs_dict[url]
49
+ summary = summary[:start] + f'[\[{citation_inx}\]]({url})' + summary[end:]
50
 
51
  return summary
52