Skip to content

Commit

Permalink
Add check for repeated entries in bibtex_to_table.py
Browse files Browse the repository at this point in the history
  • Loading branch information
XuhuiZhou committed Apr 12, 2024
1 parent 1b0309a commit 13af21b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bibtex_to_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ def bibtex_to_table(bibtex: str, taxonomy: dict[str, list[str]]) -> str:
entry_dict[field] = value
entry_dict_processed = preprocess_entry(entry_dict, taxonomy)
entries.append(entry_dict)

# check if there are repeated entries and give exact repeated entries
ids = [entry["title"] for entry in entries]
if len(ids) != len(set(ids)):
repeated_entries = [entry for entry in entries if ids.count(entry["title"]) > 1]
raise ValueError(f"Repeated entries found: {repeated_entries}")
# Create a Markdown table
headers = ["Title", "Date"] + list(taxonomy.keys()) + ["helper"]
rows = []
Expand Down

0 comments on commit 13af21b

Please sign in to comment.