First blood
Browse files- .gitignore +4 -0
- README.md +40 -2
- termith-eval.py +133 -0
- test.jsonl +0 -0
.gitignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
**.DS_Store
|
3 |
+
src/
|
4 |
+
.idea/
|
README.md
CHANGED
@@ -19,7 +19,45 @@ size_categories:
|
|
19 |
pretty_name: TermITH-Eval
|
20 |
---
|
21 |
|
22 |
-
|
23 |
# TermITH-Eval Benchmark Dataset for Keyphrase Generation
|
24 |
|
25 |
-
## About
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
pretty_name: TermITH-Eval
|
20 |
---
|
21 |
|
|
|
22 |
# TermITH-Eval Benchmark Dataset for Keyphrase Generation
|
23 |
|
24 |
+
## About
|
25 |
+
|
26 |
+
TermITH-Eval is a dataset for benchmarking keyphrase extraction and generation models.
|
27 |
+
The dataset is composed of 400 abstracts of scientific papers in French collected from the FRANCIS and PASCAL databases of the French [Institute for Scientific and Technical Information (Inist)](https://www.inist.fr/).
|
28 |
+
Keyphrases were annotated by professional indexers in an uncontrolled setting (that is, not limited to thesaurus entries).
|
29 |
+
Details about the dataset can be found in the original paper [(Bougouin et al., 2016)][bougouin-2016].
|
30 |
+
|
31 |
+
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].
|
32 |
+
|
33 |
+
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).
|
34 |
+
Stemming (Snowball stemmer implementation for french provided in `nltk`) is applied before reference keyphrases are matched against the source text.
|
35 |
+
Details about the process can be found in `prmu.py`.
|
36 |
+
|
37 |
+
## Content and statistics
|
38 |
+
|
39 |
+
The dataset contains the following test split:
|
40 |
+
|
41 |
+
| Split | # documents | #words | # keyphrases | % Present | % Reordered | % Mixed | % Unseen |
|
42 |
+
| :--------- |------------:|-------:|-------------:|----------:|------------:|--------:|---------:|
|
43 |
+
| Test | 400 | - | - | - | - | - | - |
|
44 |
+
|
45 |
+
The following data fields are available :
|
46 |
+
|
47 |
+
- **id**: unique identifier of the document.
|
48 |
+
- **title**: title of the document.
|
49 |
+
- **abstract**: abstract of the document.
|
50 |
+
- **keyphrases**: list of reference keyphrases.
|
51 |
+
- **prmu**: list of <u>P</u>resent-<u>R</u>eordered-<u>M</u>ixed-<u>U</u>nseen categories for reference keyphrases.
|
52 |
+
|
53 |
+
## References
|
54 |
+
|
55 |
+
- (Bougouin et al., 2016) Adrien Bougouin, Sabine Barreaux, Laurent Romary, Florian Boudin, and Béatrice Daille. 2016.
|
56 |
+
[TermITH-Eval: a French Standard-Based Resource for Keyphrase Extraction Evaluation][bougouin-2016].
|
57 |
+
In Proceedings of the Tenth International Conference on Language Resources and Evaluation (LREC'16), pages 1924–1927, Portorož, Slovenia. European Language Resources Association (ELRA).Language Processing, pages 543–551, Nagoya, Japan. Asian Federation of Natural Language Processing.
|
58 |
+
- (Boudin and Gallina, 2021) Florian Boudin and Ygor Gallina. 2021.
|
59 |
+
[Redefining Absent Keyphrases and their Effect on Retrieval Effectiveness][boudin-2021].
|
60 |
+
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.
|
61 |
+
|
62 |
+
[bougouin-2016]: https://aclanthology.org/L16-1304/
|
63 |
+
[boudin-2021]: https://aclanthology.org/2021.naacl-main.330/
|
termith-eval.py
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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{bougouin-etal-2016-termith,
|
12 |
+
title = "{T}erm{ITH}-Eval: a {F}rench Standard-Based Resource for Keyphrase Extraction Evaluation",
|
13 |
+
author = "Bougouin, Adrien and
|
14 |
+
Barreaux, Sabine and
|
15 |
+
Romary, Laurent and
|
16 |
+
Boudin, Florian and
|
17 |
+
Daille, B{\'e}atrice",
|
18 |
+
booktitle = "Proceedings of the Tenth International Conference on Language Resources and Evaluation ({LREC}'16)",
|
19 |
+
month = may,
|
20 |
+
year = "2016",
|
21 |
+
address = "Portoro{\v{z}}, Slovenia",
|
22 |
+
publisher = "European Language Resources Association (ELRA)",
|
23 |
+
url = "https://aclanthology.org/L16-1304",
|
24 |
+
pages = "1924--1927",
|
25 |
+
abstract = "Keyphrase extraction is the task of finding phrases that represent the important content of a document. The main aim of keyphrase extraction is to propose textual units that represent the most important topics developed in a document. The output keyphrases of automatic keyphrase extraction methods for test documents are typically evaluated by comparing them to manually assigned reference keyphrases. Each output keyphrase is considered correct if it matches one of the reference keyphrases. However, the choice of the appropriate textual unit (keyphrase) for a topic is sometimes subjective and evaluating by exact matching underestimates the performance. This paper presents a dataset of evaluation scores assigned to automatically extracted keyphrases by human evaluators. Along with the reference keyphrases, the manual evaluations can be used to validate new evaluation measures. Indeed, an evaluation measure that is highly correlated to the manual evaluation is appropriate for the evaluation of automatic keyphrase extraction methods.",
|
26 |
+
}
|
27 |
+
"""
|
28 |
+
|
29 |
+
# You can copy an official description
|
30 |
+
_DESCRIPTION = """\
|
31 |
+
TermITH-Eval benchmark dataset for keyphrase extraction an generation.
|
32 |
+
"""
|
33 |
+
|
34 |
+
# TODO: Add a link to an official homepage for the dataset here
|
35 |
+
_HOMEPAGE = "https://aclanthology.org/L16-1304.pdf"
|
36 |
+
|
37 |
+
# TODO: Add the licence for the dataset here if you can find it
|
38 |
+
_LICENSE = "Apache 2.0 License"
|
39 |
+
|
40 |
+
# TODO: Add link to the official dataset URLs here
|
41 |
+
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
42 |
+
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
43 |
+
_URLS = {
|
44 |
+
"test": "test.jsonl"
|
45 |
+
}
|
46 |
+
|
47 |
+
# TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case
|
48 |
+
class Wikinews(datasets.GeneratorBasedBuilder):
|
49 |
+
"""TODO: Short description of my dataset."""
|
50 |
+
|
51 |
+
VERSION = datasets.Version("1.0.0")
|
52 |
+
|
53 |
+
# This is an example of a dataset with multiple configurations.
|
54 |
+
# If you don't want/need to define several sub-sets in your dataset,
|
55 |
+
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
56 |
+
|
57 |
+
# If you need to make complex sub-parts in the datasets with configurable options
|
58 |
+
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
59 |
+
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
60 |
+
|
61 |
+
# You will be able to load one or the other configurations in the following list with
|
62 |
+
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
63 |
+
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
64 |
+
BUILDER_CONFIGS = [
|
65 |
+
datasets.BuilderConfig(name="raw", version=VERSION, description="This part of my dataset covers the raw data."),
|
66 |
+
]
|
67 |
+
|
68 |
+
DEFAULT_CONFIG_NAME = "raw" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
69 |
+
|
70 |
+
def _info(self):
|
71 |
+
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
72 |
+
if self.config.name == "raw": # This is the name of the configuration selected in BUILDER_CONFIGS above
|
73 |
+
features = datasets.Features(
|
74 |
+
{
|
75 |
+
"id": datasets.Value("string"),
|
76 |
+
"title": datasets.Value("string"),
|
77 |
+
"abstract": datasets.Value("string"),
|
78 |
+
"keyphrases": datasets.features.Sequence(datasets.Value("string")),
|
79 |
+
"prmu": datasets.features.Sequence(datasets.Value("string")),
|
80 |
+
}
|
81 |
+
)
|
82 |
+
return datasets.DatasetInfo(
|
83 |
+
# This is the description that will appear on the datasets page.
|
84 |
+
description=_DESCRIPTION,
|
85 |
+
# This defines the different columns of the dataset and their types
|
86 |
+
features=features, # Here we define them above because they are different between the two configurations
|
87 |
+
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
88 |
+
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
89 |
+
# supervised_keys=("sentence", "label"),
|
90 |
+
# Homepage of the dataset for documentation
|
91 |
+
homepage=_HOMEPAGE,
|
92 |
+
# License for the dataset if available
|
93 |
+
license=_LICENSE,
|
94 |
+
# Citation for the dataset
|
95 |
+
citation=_CITATION,
|
96 |
+
)
|
97 |
+
|
98 |
+
def _split_generators(self, dl_manager):
|
99 |
+
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
100 |
+
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
101 |
+
|
102 |
+
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
103 |
+
# 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.
|
104 |
+
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
105 |
+
urls = _URLS
|
106 |
+
data_dir = dl_manager.download_and_extract(urls)
|
107 |
+
return [
|
108 |
+
datasets.SplitGenerator(
|
109 |
+
name=datasets.Split.TEST,
|
110 |
+
# These kwargs will be passed to _generate_examples
|
111 |
+
gen_kwargs={
|
112 |
+
"filepath": os.path.join(data_dir["test"]),
|
113 |
+
"split": "test"
|
114 |
+
},
|
115 |
+
),
|
116 |
+
]
|
117 |
+
|
118 |
+
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
119 |
+
def _generate_examples(self, filepath, split):
|
120 |
+
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
121 |
+
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
122 |
+
with open(filepath, encoding="utf-8") as f:
|
123 |
+
for key, row in enumerate(f):
|
124 |
+
data = json.loads(row)
|
125 |
+
# Yields examples as (key, example) tuples
|
126 |
+
yield key, {
|
127 |
+
"id": data["id"],
|
128 |
+
"title": data["title"],
|
129 |
+
"abstract": data["abstract"],
|
130 |
+
"keyphrases": data["keyphrases"],
|
131 |
+
"prmu": data["prmu"],
|
132 |
+
}
|
133 |
+
|
test.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|