File size: 2,629 Bytes
2ba4d01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cd03984
2ba4d01
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a15edff
2ba4d01
 
 
 
 
 
 
b6e4b25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
"""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"),
                }
            ),
            # No default supervised_keys (as we have to pass both question
            # and context as input).
            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