Datasets:

Languages:
English
Multilinguality:
monolingual
Size Categories:
n<1K
Language Creators:
unknown
Annotations Creators:
unknown
Tags:
License:
boudinfl commited on
Commit
94bed74
1 Parent(s): 1cb6508

Update .gitattributes

Browse files
Files changed (4) hide show
  1. .gitattributes +2 -0
  2. .gitignore +3 -1
  3. README.md +18 -20
  4. semeval-2010-pre.py +148 -0
.gitattributes CHANGED
@@ -36,3 +36,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
36
  *.mp3 filter=lfs diff=lfs merge=lfs -text
37
  *.ogg filter=lfs diff=lfs merge=lfs -text
38
  *.wav filter=lfs diff=lfs merge=lfs -text
 
 
36
  *.mp3 filter=lfs diff=lfs merge=lfs -text
37
  *.ogg filter=lfs diff=lfs merge=lfs -text
38
  *.wav filter=lfs diff=lfs merge=lfs -text
39
+ test.jsonl filter=lfs diff=lfs merge=lfs -text
40
+ train.jsonl filter=lfs diff=lfs merge=lfs -text
.gitignore CHANGED
@@ -1,2 +1,4 @@
1
 
2
- .idea/
 
 
1
 
2
+ .idea/
3
+ src/
4
+ **.DS_Store
README.md CHANGED
@@ -30,26 +30,20 @@ Details about the SemEval-2010 dataset can be found in the original paper [(kim
30
 
31
  This version of the dataset was produced by [(Boudin et al., 2016)][boudin-2016] and provides four increasingly sophisticated levels of document preprocessing:
32
 
33
- * `lvl-1`: default files provided by the SemEval-2010 organizers.
34
-
35
- * `lvl-2`: for each file, we manually retrieved the original PDF file from
36
- the ACM Digital Library. We then extract the enriched textual content of
37
- the PDF files using an Optical Character Recognition (OCR) system and
38
- perform document logical structure detection using ParsCit v110505. We use
39
- the detected logical structure to remove author-assigned keyphrases and
40
- select only relevant elements : title, headers, abstract, introduction,
41
- related work, body text and conclusion. We finally apply a systematic
42
- dehyphenation at line breaks.
43
-
44
- * `lvl-3`: we further abridge the input text from level 2 preprocessed
45
- documents to the following~: title, headers, abstract, introduction,
46
- related work, background and conclusion.
47
-
48
- * `lvl-4`: we abridge the input text from level 3 preprocessed documents using
49
- an unsupervised summarization technique. We keep the title and abstract
50
- and select the most content bearing sentences from the remaining contents.
51
-
52
- Reference (indexer-assigned) keyphrases are also categorized under the PRMU (<u>P</u>resent-<u>R</u>eordered-<u>M</u>ixed-<u>U</u>nseen) scheme as proposed in [(Boudin and Gallina, 2021)][boudin-2021].
53
  Text pre-processing (tokenization) is carried out using `spacy` (`en_core_web_sm` model) with a special rule to avoid splitting words with hyphens (e.g. graph-based is kept as one token).
54
  Stemming (Porter's stemmer implementation provided in `nltk`) is applied before reference keyphrases are matched against the source text.
55
  Details about the process can be found in `prmu.py`.
@@ -68,6 +62,10 @@ The following data fields are available :
68
  - **id**: unique identifier of the document.
69
  - **title**: title of the document.
70
  - **abstract**: abstract of the document.
 
 
 
 
71
  - **keyphrases**: list of reference keyphrases.
72
  - **prmu**: list of <u>P</u>resent-<u>R</u>eordered-<u>M</u>ixed-<u>U</u>nseen categories for reference keyphrases.
73
 
30
 
31
  This version of the dataset was produced by [(Boudin et al., 2016)][boudin-2016] and provides four increasingly sophisticated levels of document preprocessing:
32
 
33
+ * `lvl-1`: default text files provided by the SemEval-2010 organizers.
34
+
35
+ * `lvl-2`: for each file, we manually retrieved the original PDF file from the ACM Digital Library.
36
+ We then extract the enriched textual content of the PDF files using an Optical Character Recognition (OCR) system and perform document logical structure detection using ParsCit v110505.
37
+ We use the detected logical structure to remove author-assigned keyphrases and select only relevant elements : title, headers, abstract, introduction, related work, body text and conclusion.
38
+ We finally apply a systematic dehyphenation at line breaks.
39
+
40
+ * `lvl-3`: we further abridge the input text from level 2 preprocessed documents to the following: title, headers, abstract, introduction, related work, background and conclusion.
41
+
42
+ * `lvl-4`: we abridge the input text from level 3 preprocessed documents using an unsupervised summarization technique.
43
+ We keep the title and abstract and select the most content bearing sentences from the remaining contents.
44
+
45
+ Reference keyphrases are provided in stemmed form (because they were provided like this for the test split in the competition).
46
+ They are also categorized under the PRMU (<u>P</u>resent-<u>R</u>eordered-<u>M</u>ixed-<u>U</u>nseen) scheme as proposed in [(Boudin and Gallina, 2021)][boudin-2021].
 
 
 
 
 
 
47
  Text pre-processing (tokenization) is carried out using `spacy` (`en_core_web_sm` model) with a special rule to avoid splitting words with hyphens (e.g. graph-based is kept as one token).
48
  Stemming (Porter's stemmer implementation provided in `nltk`) is applied before reference keyphrases are matched against the source text.
49
  Details about the process can be found in `prmu.py`.
62
  - **id**: unique identifier of the document.
63
  - **title**: title of the document.
64
  - **abstract**: abstract of the document.
65
+ - **lvl-1**: content of the document with no text processing.
66
+ - **lvl-2**: content of the document retrieved from original PDF files and cleaned up.
67
+ - **lvl-3**: content of the document further abridged to relevant sections.
68
+ - **lvl-4**: content of the document further abridged using an unsupervised summarization technique.
69
  - **keyphrases**: list of reference keyphrases.
70
  - **prmu**: list of <u>P</u>resent-<u>R</u>eordered-<u>M</u>ixed-<u>U</u>nseen categories for reference keyphrases.
71
 
semeval-2010-pre.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Inspec benchmark dataset for keyphrase extraction an generation."""
2
+
3
+ import csv
4
+ import json
5
+ import os
6
+ import datasets
7
+
8
+ # TODO: Add BibTeX citation
9
+ # Find for instance the citation on arxiv or on the dataset repo/website
10
+ _CITATION = """\
11
+ @inproceedings{boudin-etal-2016-document,
12
+ title = "How Document Pre-processing affects Keyphrase Extraction Performance",
13
+ author = "Boudin, Florian and
14
+ Mougard, Hugo and
15
+ Cram, Damien",
16
+ booktitle = "Proceedings of the 2nd Workshop on Noisy User-generated Text ({WNUT})",
17
+ month = dec,
18
+ year = "2016",
19
+ address = "Osaka, Japan",
20
+ publisher = "The COLING 2016 Organizing Committee",
21
+ url = "https://aclanthology.org/W16-3917",
22
+ pages = "121--128",
23
+ abstract = "The SemEval-2010 benchmark dataset has brought renewed attention to the task of automatic keyphrase extraction. This dataset is made up of scientific articles that were automatically converted from PDF format to plain text and thus require careful preprocessing so that irrevelant spans of text do not negatively affect keyphrase extraction performance. In previous work, a wide range of document preprocessing techniques were described but their impact on the overall performance of keyphrase extraction models is still unexplored. Here, we re-assess the performance of several keyphrase extraction models and measure their robustness against increasingly sophisticated levels of document preprocessing.",
24
+ }
25
+ """
26
+
27
+ # You can copy an official description
28
+ _DESCRIPTION = """\
29
+ Preprocessed SemEval-2010 Benchmark dataset for Keyphrase Generation.
30
+ """
31
+
32
+ # TODO: Add a link to an official homepage for the dataset here
33
+ _HOMEPAGE = "https://aclanthology.org/W16-3917.pdf"
34
+
35
+ # TODO: Add the licence for the dataset here if you can find it
36
+ _LICENSE = "Apache 2.0 License"
37
+
38
+ # TODO: Add link to the official dataset URLs here
39
+ # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
40
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
41
+ _URLS = {
42
+ "test": "test.jsonl"
43
+ "train": "train.jsonl"
44
+ }
45
+
46
+ # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
47
+ class SemEval(datasets.GeneratorBasedBuilder):
48
+ """TODO: Short description of my dataset."""
49
+
50
+ VERSION = datasets.Version("1.0.0")
51
+
52
+ # This is an example of a dataset with multiple configurations.
53
+ # If you don't want/need to define several sub-sets in your dataset,
54
+ # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
55
+
56
+ # If you need to make complex sub-parts in the datasets with configurable options
57
+ # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
58
+ # BUILDER_CONFIG_CLASS = MyBuilderConfig
59
+
60
+ # You will be able to load one or the other configurations in the following list with
61
+ # data = datasets.load_dataset('my_dataset', 'first_domain')
62
+ # data = datasets.load_dataset('my_dataset', 'second_domain')
63
+ BUILDER_CONFIGS = [
64
+ datasets.BuilderConfig(name="raw", version=VERSION, description="This part of my dataset covers the raw data."),
65
+ ]
66
+
67
+ DEFAULT_CONFIG_NAME = "raw" # It's not mandatory to have a default configuration. Just use one if it make sense.
68
+
69
+ def _info(self):
70
+ # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
71
+ if self.config.name == "raw": # This is the name of the configuration selected in BUILDER_CONFIGS above
72
+ features = datasets.Features(
73
+ {
74
+ "id": datasets.Value("string"),
75
+ "title": datasets.Value("string"),
76
+ "abstract": datasets.Value("string"),
77
+ "keyphrases": datasets.features.Sequence(datasets.Value("string")),
78
+ "prmu": datasets.features.Sequence(datasets.Value("string")),
79
+ "lvl-1": datasets.Value("string"),
80
+ "lvl-2": datasets.Value("string"),
81
+ "lvl-3": datasets.Value("string"),
82
+ "lvl-4": datasets.Value("string"),
83
+ }
84
+ )
85
+ return datasets.DatasetInfo(
86
+ # This is the description that will appear on the datasets page.
87
+ description=_DESCRIPTION,
88
+ # This defines the different columns of the dataset and their types
89
+ features=features, # Here we define them above because they are different between the two configurations
90
+ # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
91
+ # specify them. They'll be used if as_supervised=True in builder.as_dataset.
92
+ # supervised_keys=("sentence", "label"),
93
+ # Homepage of the dataset for documentation
94
+ homepage=_HOMEPAGE,
95
+ # License for the dataset if available
96
+ license=_LICENSE,
97
+ # Citation for the dataset
98
+ citation=_CITATION,
99
+ )
100
+
101
+ def _split_generators(self, dl_manager):
102
+ # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
103
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
104
+
105
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
106
+ # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
107
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
108
+ urls = _URLS
109
+ data_dir = dl_manager.download_and_extract(urls)
110
+ return [
111
+ datasets.SplitGenerator(
112
+ name=datasets.Split.TEST,
113
+ # These kwargs will be passed to _generate_examples
114
+ gen_kwargs={
115
+ "filepath": os.path.join(data_dir["test"]),
116
+ "split": "test"
117
+ },
118
+ ),
119
+ datasets.SplitGenerator(
120
+ name=datasets.Split.TRAIN,
121
+ # These kwargs will be passed to _generate_examples
122
+ gen_kwargs={
123
+ "filepath": os.path.join(data_dir["train"]),
124
+ "split": "train"
125
+ },
126
+ ),
127
+ ]
128
+
129
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
130
+ def _generate_examples(self, filepath, split):
131
+ # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
132
+ # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
133
+ with open(filepath, encoding="utf-8") as f:
134
+ for key, row in enumerate(f):
135
+ data = json.loads(row)
136
+ # Yields examples as (key, example) tuples
137
+ yield key, {
138
+ "id": data["id"],
139
+ "title": data["title"],
140
+ "abstract": data["abstract"],
141
+ "keyphrases": data["keyphrases"],
142
+ "prmu": data["prmu"],
143
+ "lvl-1": data["lvl-1"],
144
+ "lvl-2": data["lvl-2"],
145
+ "lvl-3": data["lvl-3"],
146
+ "lvl-4": data["lvl-4"],
147
+ }
148
+