-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d70eed6
commit dc736be
Showing
4 changed files
with
3,140 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from typing import Dict, Union | ||
|
||
import bibtexparser | ||
from datasets import DatasetDict | ||
|
||
|
||
def get_citations(dataset: DatasetDict, citation_as_dict: bool = True) -> Dict[str, Union[Dict, str]]: | ||
lines = dataset.citation.split("% Datasets: ")[1:] | ||
original_dataset_to_bibtex = {} | ||
for line in lines: | ||
original_datasets, citation = line.split("\n", maxsplit=1) | ||
dataset_list = original_datasets.split(", ") | ||
|
||
for dataset in dataset_list: | ||
original_dataset_to_bibtex[dataset] = bibtexparser.loads(citation).entries[0] if citation_as_dict else citation | ||
return original_dataset_to_bibtex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.