Merge branch 'main' of https://huggingface.co/DeDeckerThomas/keyphrase-extraction-kbir-inspec
Browse files
README.md
CHANGED
@@ -8,7 +8,24 @@ datasets:
|
|
8 |
- midas/inspec
|
9 |
metrics:
|
10 |
- seqeval
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
---
|
13 |
** Work in progress **
|
14 |
# π Keyphrase Extraction model: KBIR-inspec
|
@@ -18,11 +35,27 @@ Now with the recent innovations in deep learning methods (such as recurrent neur
|
|
18 |
|
19 |
|
20 |
## π Model Description
|
21 |
-
This model is a KBIR pre-trained model
|
22 |
-
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
## β Intended uses & limitations
|
|
|
|
|
|
|
|
|
|
|
26 |
### β How to use
|
27 |
```python
|
28 |
# Define post_process functions
|
@@ -114,20 +147,16 @@ and context of a document, which is quite an improvement.
|
|
114 |
'semantics' 'statistics' 'text analysis' 'transformers']
|
115 |
```
|
116 |
|
117 |
-
|
118 |
-
|
119 |
-
* Only works in English.
|
120 |
|
121 |
-
|
122 |
-
## π·ββοΈ Training procedure
|
123 |
-
The model is fine-tuned as a token classification problem where the text is labeled using the BIO scheme.
|
124 |
-
- B => Begin of a keyphrase
|
125 |
-
- I => Inside of a keyphrase
|
126 |
-
- O => Ouside of a keyphrase
|
127 |
|
128 |
-
|
|
|
129 |
|
130 |
### Preprocessing
|
|
|
131 |
```python
|
132 |
def preprocess_fuction(all_samples_per_split):
|
133 |
tokenized_samples = tokenizer.batch_encode_plus(
|
@@ -165,18 +194,11 @@ def preprocess_fuction(all_samples_per_split):
|
|
165 |
```
|
166 |
## πEvaluation results
|
167 |
|
168 |
-
One of the traditional evaluation methods
|
169 |
The model achieves the following results on the Inspec test set:
|
170 |
|
171 |
| Dataset | P@5 | R@5 | F1@5 | P@10 | R@10 | F1@10 | P@M | R@M | F1@M |
|
172 |
|:-----------------:|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|
|
173 |
| Inspec Test Set | 0.53 | 0.47 | 0.46 | 0.36 | 0.58 | 0.41 | 0.58 | 0.60 | 0.56 |
|
174 |
|
175 |
-
For more information on the evaluation process, you can take a look at the keyphrase extraction evaluation notebook.
|
176 |
-
|
177 |
-
### Bibliography
|
178 |
-
Debanjan Mahata, Navneet Agarwal, Dibya Gautam, Amardeep Kumar, Sagar Dhiman, Anish Acharya, & Rajiv Ratn Shah. (2021). LDkp Dataset [Data set]. Zenodo. https://doi.org/10.5281/zenodo.5501744
|
179 |
-
|
180 |
-
Kulkarni, Mayank, Debanjan Mahata, Ravneet Arora, and Rajarshi Bhowmik. "Learning Rich Representation of Keyphrases from Text." arXiv preprint arXiv:2112.08547 (2021).
|
181 |
-
|
182 |
-
Sahrawat, Dhruva, Debanjan Mahata, Haimin Zhang, Mayank Kulkarni, Agniv Sharma, Rakesh Gosangi, Amanda Stent, Yaman Kumar, Rajiv Ratn Shah, and Roger Zimmermann. "Keyphrase extraction as sequence labeling using contextualized embeddings." In European Conference on Information Retrieval, pp. 328-335. Springer, Cham, 2020.
|
|
|
8 |
- midas/inspec
|
9 |
metrics:
|
10 |
- seqeval
|
11 |
+
widget:
|
12 |
+
- text: "Keyphrase extraction is a technique in text analysis where you extract the important keyphrases from a text. Since this is a time-consuming process, Artificial Intelligence is used to automate it. Currently, classical machine learning methods, that use statistics and linguistics, are widely used for the extraction process. The fact that these methods have been widely used in the community has the advantage that there are many easy-to-use libraries. Now with the recent innovations in deep learning methods (such as recurrent neural networks and transformers, GANS, β¦), keyphrase extraction can be improved. These new methods also focus on the semantics and context of a document, which is quite an improvement."
|
13 |
+
example_title: "Example 1"
|
14 |
+
- text: "In this work, we explore how to learn task specific language models aimed towards learning rich representation of keyphrases from text documents. We experiment with different masking strategies for pre-training transformer language models (LMs) in discriminative as well as generative settings. In the discriminative setting, we introduce a new pre-training objective - Keyphrase Boundary Infilling with Replacement (KBIR), showing large gains in performance (up to 9.26 points in F1) over SOTA, when LM pre-trained using KBIR is fine-tuned for the task of keyphrase extraction. In the generative setting, we introduce a new pre-training setup for BART - KeyBART, that reproduces the keyphrases related to the input text in the CatSeq format, instead of the denoised original input. This also led to gains in performance (up to 4.33 points inF1@M) over SOTA for keyphrase generation. Additionally, we also fine-tune the pre-trained language models on named entity recognition(NER), question answering (QA), relation extraction (RE), abstractive summarization and achieve comparable performance with that of the SOTA, showing that learning rich representation of keyphrases is indeed beneficial for many other fundamental NLP tasks."
|
15 |
+
example_title: "Example 2"
|
16 |
+
model-index:
|
17 |
+
- name: DeDeckerThomas/keyphrase-extraction-kbir-inspec
|
18 |
+
results:
|
19 |
+
- task:
|
20 |
+
type: keyphrase-extraction
|
21 |
+
name: Keyphrase Extraction
|
22 |
+
dataset:
|
23 |
+
type: midas/inspec
|
24 |
+
name: inspec
|
25 |
+
metrics:
|
26 |
+
- type: seqeval
|
27 |
+
value: 0.588
|
28 |
+
name: F1-score
|
29 |
---
|
30 |
** Work in progress **
|
31 |
# π Keyphrase Extraction model: KBIR-inspec
|
|
|
35 |
|
36 |
|
37 |
## π Model Description
|
38 |
+
This model is a fine-tuned KBIR model on the Inspec dataset. KBIR or Keyphrase Boundary Infilling with Replacement is a pre-trained model which utilizes a multi-task learning setup for optimizing a combined loss of Masked Language Modeling (MLM), Keyphrase Boundary Infilling (KBI) and Keyphrase Replacement Classification (KRC).
|
39 |
+
You can find more information about the architecture in this paper: https://arxiv.org/abs/2112.08547.
|
40 |
+
|
41 |
+
The model is fine-tuned as a token classification problem where the text is labeled using the BIO scheme.
|
42 |
+
|
43 |
+
| Label | Description |
|
44 |
+
| ----- | ------------------------------- |
|
45 |
+
| B | At the beginning of a keyphrase |
|
46 |
+
| I | Inside a keyphrase |
|
47 |
+
| O | Outside a keyphrase |
|
48 |
+
|
49 |
+
Kulkarni, Mayank, Debanjan Mahata, Ravneet Arora, and Rajarshi Bhowmik. "Learning Rich Representation of Keyphrases from Text." arXiv preprint arXiv:2112.08547 (2021).
|
50 |
+
|
51 |
+
Sahrawat, Dhruva, Debanjan Mahata, Haimin Zhang, Mayank Kulkarni, Agniv Sharma, Rakesh Gosangi, Amanda Stent, Yaman Kumar, Rajiv Ratn Shah, and Roger Zimmermann. "Keyphrase extraction as sequence labeling using contextualized embeddings." In European Conference on Information Retrieval, pp. 328-335. Springer, Cham, 2020.
|
52 |
|
53 |
## β Intended uses & limitations
|
54 |
+
### π Limitations
|
55 |
+
* This keyphrase extraction model is very domain-specific and will perform very well on abstracts of scientific papers. It's not recommended to use this model for other domains, but you are free to test it out.
|
56 |
+
* Only works for English documents.
|
57 |
+
* For a custom model, please consult the training notebook for more information (link incoming).
|
58 |
+
|
59 |
### β How to use
|
60 |
```python
|
61 |
# Define post_process functions
|
|
|
147 |
'semantics' 'statistics' 'text analysis' 'transformers']
|
148 |
```
|
149 |
|
150 |
+
## π Training Dataset
|
151 |
+
Inspec is a keyphrase extraction/generation dataset consisting of 2000 English scientific papers from the scientific domains of Computers and Control and Information Technology published between 1998 to 2002. The keyphrases are annotated by professional indexers or editors.
|
|
|
152 |
|
153 |
+
You can find more information here: https://huggingface.co/datasets/midas/inspec
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
+
## π·ββοΈ Training procedure
|
156 |
+
For more in detail information, you can take a look at the training notebook (link incoming).
|
157 |
|
158 |
### Preprocessing
|
159 |
+
The documents in the dataset are already preprocessed into list of words with the corresponding labels. The only thing that must be done is tokenization and the realignment of the labels so that they correspond with the right subword tokens.
|
160 |
```python
|
161 |
def preprocess_fuction(all_samples_per_split):
|
162 |
tokenized_samples = tokenizer.batch_encode_plus(
|
|
|
194 |
```
|
195 |
## πEvaluation results
|
196 |
|
197 |
+
One of the traditional evaluation methods is the precision, recall and F1-score @k,m where k is the number that stands for the first k predicted keyphrases and m for the average amount of predicted keyphrases.
|
198 |
The model achieves the following results on the Inspec test set:
|
199 |
|
200 |
| Dataset | P@5 | R@5 | F1@5 | P@10 | R@10 | F1@10 | P@M | R@M | F1@M |
|
201 |
|:-----------------:|:----:|:----:|:----:|:----:|:----:|:-----:|:----:|:----:|:----:|
|
202 |
| Inspec Test Set | 0.53 | 0.47 | 0.46 | 0.36 | 0.58 | 0.41 | 0.58 | 0.60 | 0.56 |
|
203 |
|
204 |
+
For more information on the evaluation process, you can take a look at the keyphrase extraction evaluation notebook.
|
|
|
|
|
|
|
|
|
|
|
|
|
|