Pclanglais commited on
Commit
227499e
·
verified ·
1 Parent(s): 033a22d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -116,21 +116,21 @@ def extract_year(text):
116
 
117
  def create_bibtex_entry(data):
118
  # Determine the entry type
119
- if 'Journal' in data:
120
  entry_type = 'article'
121
- elif 'Booktitle' in data:
122
- entry_type = 'incollection'
123
  else:
124
  entry_type = 'book'
125
 
126
  # Extract year from 'None' if it exists
127
- none_content = data.pop('None', '')
128
  year = extract_year(none_content)
129
- if year and 'Year' not in data:
130
- data['Year'] = year
131
 
132
  # Create BibTeX ID
133
- author_words = data.get('Author', '').split()
134
  first_author = author_words[0] if author_words else 'Unknown'
135
  bibtex_id = f"{first_author}{year}" if year else first_author
136
 
 
116
 
117
  def create_bibtex_entry(data):
118
  # Determine the entry type
119
+ if 'journal' in data:
120
  entry_type = 'article'
121
+ elif 'booktitle' in data:
122
+ entry_type = 'chapter'
123
  else:
124
  entry_type = 'book'
125
 
126
  # Extract year from 'None' if it exists
127
+ none_content = data.pop('none', '')
128
  year = extract_year(none_content)
129
+ if year and 'year' not in data:
130
+ data['year'] = year
131
 
132
  # Create BibTeX ID
133
+ author_words = data.get('author', '').split()
134
  first_author = author_words[0] if author_words else 'Unknown'
135
  bibtex_id = f"{first_author}{year}" if year else first_author
136