| """Co-occurrenceCitationQuintuple""" |
|
|
| import json |
|
|
| import datasets |
| from datasets.tasks import QuestionAnsweringExtractive |
|
|
|
|
| logger = datasets.logging.get_logger(__name__) |
|
|
|
|
| _CITATION = """\ |
| @inproceedings{xu2023exploring, |
| title={Exploring and Verbalizing Academic Ideas by Concept Co-occurrence}, |
| author={Xu, Yi and Sheng, Shuqian and Xue, Bo and Fu, Luoyi and Wang, Xinbing and Zhou, Chenghu}, |
| booktitle={Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (ACL)}, |
| year={2023} |
| } |
| """ |
|
|
| _DESCRIPTION = """\ |
| It is the official Co-occurrence Citation Quintuple dataset of paper \ |
| Exploring and Verbalizing Academic Ideas by Concept Co-occurrence. |
| """ |
|
|
| _URL = "https://github.com/xyjigsaw/Kiscovery" |
|
|
|
|
| class QuintupleConfig(datasets.BuilderConfig): |
| """BuilderConfig for Quintuple.""" |
|
|
| def __init__(self, **kwargs): |
| """BuilderConfig for Quintuple. |
| Args: |
| **kwargs: keyword arguments forwarded to super. |
| """ |
| super(QuintupleConfig, self).__init__(**kwargs) |
|
|
|
|
| class Quintuple(datasets.GeneratorBasedBuilder): |
| """Quintuple: V202306""" |
|
|
| BUILDER_CONFIGS = [ |
| QuintupleConfig( |
| name="plain_text", |
| version=datasets.Version("1.2023.06", ""), |
| description="Plain text", |
| ), |
| ] |
|
|
| def _info(self): |
| return datasets.DatasetInfo( |
| description=_DESCRIPTION, |
| features=datasets.Features( |
| { |
| "c1": datasets.Value("string"), |
| "c2": datasets.Value("string"), |
| "p": datasets.Value("string"), |
| "p1": datasets.Value("string"), |
| "p2": datasets.Value("string"), |
| } |
| ), |
| |
| |
| supervised_keys=None, |
| homepage="https://github.com/xyjigsaw/Kiscovery", |
| citation=_CITATION, |
| ) |
|
|
| def _generate_examples(self, filepath): |
| """This function returns the examples in the raw (text) form.""" |
| logger.info("generating examples from = %s", filepath) |
| key = 0 |
| with open(filepath, encoding="utf-8") as f: |
| all_text = json.load(f) |
| for item in all_text[:100]: |
| yield key, { |
| "c1": item[0], |
| "c2": item[1], |
| "p": item[2], |
| "p1": item[3], |
| "p2": item[4], |
| } |
| key += 1 |
|
|