chendelong1999 commited on
Commit
597458d
1 Parent(s): 4ade2ba

et al for 5+ authors

Browse files
Files changed (1) hide show
  1. app.py +12 -1
app.py CHANGED
@@ -96,13 +96,24 @@ def get_abbreviated_venue(name):
96
  def get_md_citation(paper_info):
97
 
98
  # citation_str = paper_info['authors'][0]['name'] + " *et al.* "
99
- citation_str = ', '.join([author['name'] for author in paper_info['authors']]) + '. '
 
 
 
 
 
 
 
 
 
 
100
  citation_str += f"[{paper_info['title']}]({paper_info['url']}). "
101
  citation_str += f"*{get_abbreviated_venue(paper_info['venue'])}*"
102
  # citation_str += f" ({paper_info['year']})."
103
  citation_str += f" ({paper_info['publicationDate'][:-3].replace('-', '.')})."
104
  return citation_str
105
 
 
106
  def summarize_paper_info(paper_info):
107
  info_str = ""
108
  # info_str += f"**Venue**: {paper_info['venue']}\n\n"
 
96
  def get_md_citation(paper_info):
97
 
98
  # citation_str = paper_info['authors'][0]['name'] + " *et al.* "
99
+ # citation_str = ', '.join([author['name'] for author in paper_info['authors']]) + '. '
100
+ citation_str = ''
101
+ for author in paper_info['authors'][:5]:
102
+ citation_str += f"{author['name']}, "
103
+
104
+ if len(paper_info['authors'])>5:
105
+ citation_str += '*et al.* '
106
+ else:
107
+ citation_str = citation_str[:-2] + '. '
108
+
109
+
110
  citation_str += f"[{paper_info['title']}]({paper_info['url']}). "
111
  citation_str += f"*{get_abbreviated_venue(paper_info['venue'])}*"
112
  # citation_str += f" ({paper_info['year']})."
113
  citation_str += f" ({paper_info['publicationDate'][:-3].replace('-', '.')})."
114
  return citation_str
115
 
116
+
117
  def summarize_paper_info(paper_info):
118
  info_str = ""
119
  # info_str += f"**Venue**: {paper_info['venue']}\n\n"