Datasets:

Modalities:
Text
Libraries:
Datasets
License:
boudinfl commited on
Commit
dc3b07d
1 Parent(s): 195c19e

First blood

Browse files
Files changed (4) hide show
  1. .gitignore +3 -0
  2. README.md +44 -0
  3. taln-archives.py +130 -0
  4. test.jsonl +0 -0
.gitignore ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ src/
2
+ .DS_Store
3
+ .idea/
README.md ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TALN-Archives Benchmark Dataset for Keyphrase Generation
2
+
3
+ ## About
4
+
5
+ TALN-Archives is a dataset for benchmarking keyphrase extraction and generation models.
6
+ The dataset is composed of 1207 abstracts of scientific papers in French collected from the [TALN Archives](http://talnarchives.atala.org/).
7
+ Keyphrases were annotated by authors in an uncontrolled setting (that is, not limited to thesaurus entries).
8
+ English translations of title/abstract/keyphrases are also available for a subset of the documents, allowing to experiment with cross-lingual / multilingual keyphrase generation.
9
+ Details about the dataset can be found in the original paper [(Boudin, 2013)][boudin-2013].
10
+
11
+ 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].
12
+
13
+ Text pre-processing (tokenization) is carried out using `spacy` (`fr_core_news_sm` model) with a special rule to avoid splitting words with hyphens (e.g. graph-based is kept as one token).
14
+ Stemming (Snowball stemmer implementation for french provided in `nltk`) is applied before reference keyphrases are matched against the source text.
15
+ Details about the process can be found in `prmu.py`.
16
+
17
+ ## Content and statistics
18
+
19
+ The dataset contains the following test split:
20
+
21
+ | Split | # documents | #words | # keyphrases | % Present | % Reordered | % Mixed | % Unseen |
22
+ | :--------- | ----------: | -----: | -----------: | --------: | ----------: | ------: | -------: |
23
+ | Test | 1207 | - | - | - | - | - | - |
24
+
25
+ The following data fields are available :
26
+
27
+ - **id**: unique identifier of the document.
28
+ - **title**: title of the document.
29
+ - **abstract**: abstract of the document.
30
+ - **keyphrases**: list of reference keyphrases.
31
+ - **prmu**: list of <u>P</u>resent-<u>R</u>eordered-<u>M</u>ixed-<u>U</u>nseen categories for reference keyphrases.
32
+ - **translation**: translations of title, abstract and keyphrases in English if available.
33
+
34
+ ## References
35
+
36
+ - (Boudin, 2013) Florian Boudin. 2013.
37
+ [TALN Archives : a digital archive of French research articles in Natural Language Processing (TALN Archives : une archive numérique francophone des articles de recherche en Traitement Automatique de la Langue) [in French]][boudin-2013].
38
+ In Proceedings of TALN 2013 (Volume 2: Short Papers), pages 507–514, Les Sables d’Olonne, France. ATALA.
39
+ - (Boudin and Gallina, 2021) Florian Boudin and Ygor Gallina. 2021.
40
+ [Redefining Absent Keyphrases and their Effect on Retrieval Effectiveness][boudin-2021].
41
+ In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4185–4193, Online. Association for Computational Linguistics.
42
+
43
+ [boudin-2013]: https://aclanthology.org/F13-2001/
44
+ [boudin-2021]: https://aclanthology.org/2021.naacl-main.330/
taln-archives.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """TALN Archives 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-2013-taln,
12
+ title = "{TALN} Archives : a digital archive of {F}rench research articles in Natural Language Processing ({TALN} Archives : une archive num{\'e}rique francophone des articles de recherche en Traitement Automatique de la Langue) [in {F}rench]",
13
+ author = "Boudin, Florian",
14
+ booktitle = "Proceedings of TALN 2013 (Volume 2: Short Papers)",
15
+ month = jun,
16
+ year = "2013",
17
+ address = "Les Sables d{'}Olonne, France",
18
+ publisher = "ATALA",
19
+ url = "https://aclanthology.org/F13-2001",
20
+ pages = "507--514",
21
+ }
22
+ """
23
+
24
+ # You can copy an official description
25
+ _DESCRIPTION = """\
26
+ TALN Archives benchmark dataset for keyphrase extraction an generation.
27
+ """
28
+
29
+ # TODO: Add a link to an official homepage for the dataset here
30
+ _HOMEPAGE = "https://aclanthology.org/F13-2001.pdf"
31
+
32
+ # TODO: Add the licence for the dataset here if you can find it
33
+ _LICENSE = "Apache 2.0 License"
34
+
35
+ # TODO: Add link to the official dataset URLs here
36
+ # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
37
+ # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
38
+ _URLS = {
39
+ "test": "test.jsonl"
40
+ }
41
+
42
+ # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
43
+ class Inspec(datasets.GeneratorBasedBuilder):
44
+ """TODO: Short description of my dataset."""
45
+
46
+ VERSION = datasets.Version("1.0.0")
47
+
48
+ # This is an example of a dataset with multiple configurations.
49
+ # If you don't want/need to define several sub-sets in your dataset,
50
+ # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
51
+
52
+ # If you need to make complex sub-parts in the datasets with configurable options
53
+ # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
54
+ # BUILDER_CONFIG_CLASS = MyBuilderConfig
55
+
56
+ # You will be able to load one or the other configurations in the following list with
57
+ # data = datasets.load_dataset('my_dataset', 'first_domain')
58
+ # data = datasets.load_dataset('my_dataset', 'second_domain')
59
+ BUILDER_CONFIGS = [
60
+ datasets.BuilderConfig(name="raw", version=VERSION, description="This part of my dataset covers the raw data."),
61
+ ]
62
+
63
+ DEFAULT_CONFIG_NAME = "raw" # It's not mandatory to have a default configuration. Just use one if it make sense.
64
+
65
+ def _info(self):
66
+ # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
67
+ if self.config.name == "raw": # This is the name of the configuration selected in BUILDER_CONFIGS above
68
+ features = datasets.Features(
69
+ {
70
+ "id": datasets.Value("int64"),
71
+ "title": datasets.Value("string"),
72
+ "abstract": datasets.Value("string"),
73
+ "keyphrases": datasets.features.Sequence(datasets.Value("string")),
74
+ "prmu": datasets.features.Sequence(datasets.Value("string")),
75
+ "translation": datasets.features.Sequence(datasets.Value("string")),
76
+ }
77
+ )
78
+ return datasets.DatasetInfo(
79
+ # This is the description that will appear on the datasets page.
80
+ description=_DESCRIPTION,
81
+ # This defines the different columns of the dataset and their types
82
+ features=features, # Here we define them above because they are different between the two configurations
83
+ # If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
84
+ # specify them. They'll be used if as_supervised=True in builder.as_dataset.
85
+ # supervised_keys=("sentence", "label"),
86
+ # Homepage of the dataset for documentation
87
+ homepage=_HOMEPAGE,
88
+ # License for the dataset if available
89
+ license=_LICENSE,
90
+ # Citation for the dataset
91
+ citation=_CITATION,
92
+ )
93
+
94
+ def _split_generators(self, dl_manager):
95
+ # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
96
+ # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
97
+
98
+ # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
99
+ # 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.
100
+ # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
101
+ urls = _URLS
102
+ data_dir = dl_manager.download_and_extract(urls)
103
+ return [
104
+ datasets.SplitGenerator(
105
+ name=datasets.Split.TEST,
106
+ # These kwargs will be passed to _generate_examples
107
+ gen_kwargs={
108
+ "filepath": os.path.join(data_dir["test"]),
109
+ "split": "test"
110
+ },
111
+ ),
112
+ ]
113
+
114
+ # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
115
+ def _generate_examples(self, filepath, split):
116
+ # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
117
+ # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
118
+ with open(filepath, encoding="utf-8") as f:
119
+ for key, row in enumerate(f):
120
+ data = json.loads(row)
121
+ # Yields examples as (key, example) tuples
122
+ yield key, {
123
+ "id": data["id"],
124
+ "title": data["title"],
125
+ "abstract": data["abstract"],
126
+ "keyphrases": data["keyphrases"],
127
+ "prmu": data["prmu"],
128
+ "translation": data["translation"],
129
+ }
130
+
test.jsonl ADDED
The diff for this file is too large to render. See raw diff