andreim14 commited on
Commit
6b95e98
1 Parent(s): 82d1e29

added config and readme

Browse files
Files changed (2) hide show
  1. README.md +136 -1
  2. config.yaml +17 -0
README.md CHANGED
@@ -1,3 +1,138 @@
1
  ---
2
- license: cc-by-nc-sa-4.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license:
3
+ - cc-by-nc-sa-4.0
4
+ source_datasets:
5
+ - original
6
+ task_ids:
7
+ - word-sense-disambiguation
8
+ pretty_name: word-sense-linking-dataset
9
+ tags:
10
+ - word-sense-linking
11
+ - word-sense-disambiguation
12
+ - lexical-semantics
13
+ size_categories:
14
+ - 10K<n<100K
15
+ extra_gated_fields:
16
+ Email: text
17
+ Company: text
18
+ Country: country
19
+ I want to use this dataset for:
20
+ type: select
21
+ options:
22
+ - Research
23
+ - Education
24
+ - label: Other
25
+ value: other
26
+ I agree to use this dataset for non-commercial use ONLY: checkbox
27
+ extra_gated_heading: "Acknowledge our [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0)](https://github.com/Babelscape/WSL/wsl_data_license.txt) to access the repository"
28
+ extra_gated_description: "Our team may take 2-3 days to process your request"
29
+ extra_gated_button_content: "Acknowledge license"
30
  ---
31
+ ---
32
+
33
+
34
+ # Word Sense Linking: Disambiguating Outside the Sandbox
35
+
36
+ [![Conference](http://img.shields.io/badge/ACL-2024-4b44ce.svg)](https://2024.aclweb.org/)
37
+ [![Paper](http://img.shields.io/badge/paper-ACL--anthology-B31B1B.svg)](https://aclanthology.org/)
38
+ [![Hugging Face Collection](https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-FCD21D)](https://huggingface.co/collections/Babelscape/word-sense-linking-66ace2182bc45680964cefcb)
39
+
40
+ ## Model Description
41
+
42
+ The Word Sense Linking model is designed to identify and disambiguate spans of text to their most suitable senses from a reference inventory. The annotations are provided as sense keys from WordNet, a large lexical database of English.
43
+
44
+ ## Installation
45
+
46
+ Installation from PyPI:
47
+
48
+ ```bash
49
+ git clone https://github.com/Babelscape/WSL
50
+ cd WSL
51
+ pip install -r requirements.txt
52
+ ```
53
+
54
+
55
+
56
+ ## Usage
57
+
58
+ WSL is composed of two main components: a retriever and a reader.
59
+ The retriever is responsible for retrieving relevant senses from a senses inventory (e.g WordNet),
60
+ while the reader is responsible for extracting spans from the input text and link them to the retrieved documents.
61
+ WSL can be used with the `from_pretrained` method to load a pre-trained pipeline.
62
+
63
+ ```python
64
+ from wsl import WSL
65
+ from wsl.inference.data.objects import WSLOutput
66
+
67
+ wsl_model = WSL.from_pretrained("Babelscape/wsl-base")
68
+ relik_out: WSLOutput = wsl_model("Bus drivers drive busses for a living.")
69
+ ```
70
+
71
+ WSLOutput(
72
+ text='Bus drivers drive busses for a living.',
73
+ tokens=['Bus', 'drivers', 'drive', 'busses', 'for', 'a', 'living', '.'],
74
+ id=0,
75
+ spans=[
76
+ Span(start=0, end=11, label='bus driver: someone who drives a bus', text='Bus drivers'),
77
+ Span(start=12, end=17, label='drive: operate or control a vehicle', text='drive'),
78
+ Span(start=18, end=24, label='bus: a vehicle carrying many passengers; used for public transport', text='busses'),
79
+ Span(start=31, end=37, label='living: the financial means whereby one lives', text='living')
80
+ ],
81
+ candidates=Candidates(
82
+ candidates=[
83
+ {"text": "bus driver: someone who drives a bus", "id": "bus_driver%1:18:00::", "metadata": {}},
84
+ {"text": "driver: the operator of a motor vehicle", "id": "driver%1:18:00::", "metadata": {}},
85
+ {"text": "driver: someone who drives animals that pull a vehicle", "id": "driver%1:18:02::", "metadata": {}},
86
+ {"text": "bus: a vehicle carrying many passengers; used for public transport", "id": "bus%1:06:00::", "metadata": {}},
87
+ {"text": "living: the financial means whereby one lives", "id": "living%1:26:00::", "metadata": {}}
88
+ ]
89
+ ),
90
+ )
91
+
92
+
93
+
94
+ ## Model Performance
95
+
96
+ Here you can find the performances of our model on the [WSL evaluation dataset](https://huggingface.co/datasets/Babelscape/wsl).
97
+
98
+ ### Validation (SE07)
99
+
100
+ | Models | P | R | F1 |
101
+ |--------------|------|--------|--------|
102
+ | BEM_SUP | 67.6 | 40.9 | 51.0 |
103
+ | BEM_HEU | 70.8 | 51.2 | 59.4 |
104
+ | ConSeC_SUP | 76.4 | 46.5 | 57.8 |
105
+ | ConSeC_HEU | **76.7** | 55.4 | 64.3 |
106
+ | **Our Model**| 73.8 | **74.9** | **74.4** |
107
+
108
+ ### Test (ALL_FULL)
109
+
110
+ | Models | P | R | F1 |
111
+ |--------------|------|--------|--------|
112
+ | BEM_SUP | 74.8 | 50.7 | 60.4 |
113
+ | BEM_HEU | 76.6 | 61.2 | 68.0 |
114
+ | ConSeC_SUP | 78.9 | 53.1 | 63.5 |
115
+ | ConSeC_HEU | **80.4** | 64.3 | 71.5 |
116
+ | **Our Model**| 75.2 | **76.7** | **75.9** |
117
+
118
+
119
+
120
+ ## Additional Information
121
+ **Licensing Information**: Contents of this repository are restricted to only non-commercial research purposes under the [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License (CC BY-NC-SA 4.0)](https://creativecommons.org/licenses/by-nc-sa/4.0/). Copyright of the dataset contents belongs to Babelscape.
122
+
123
+ ## Citation Information
124
+
125
+
126
+ ```bibtex
127
+ @inproceedings{bejgu-etal-2024-wsl,
128
+ title = "Word Sense Linking: Disambiguating Outside the Sandbox",
129
+ author = "Bejgu, Andrei Stefan and Barba, Edoardo and Procopio, Luigi and Fern{\'a}ndez-Castro, Alberte and Navigli, Roberto",
130
+ booktitle = "Findings of the Association for Computational Linguistics: ACL 2024",
131
+ month = aug,
132
+ year = "2024",
133
+ address = "Bangkok, Thailand",
134
+ publisher = "Association for Computational Linguistics",
135
+ }
136
+ ```
137
+
138
+ **Contributions**: Thanks to [@andreim14](https://github.com/andreim14), [@edobobo](https://github.com/edobobo), [@poccio](https://github.com/poccio) and [@navigli](https://github.com/navigli) for adding this model.
config.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _target_: wsl.inference.annotator.WSL
2
+ retriever:
3
+ span:
4
+ _target_: wsl.retriever.pytorch_modules.model.WSLRetriever
5
+ question_encoder: Babelscape/wsl-retriever-e5-base-v2
6
+ index:
7
+ span:
8
+ _target_: wsl.retriever.indexers.inmemory.InMemoryDocumentIndex.from_pretrained
9
+ name_or_path: Babelscape/wsl-retriever-e5-base-v2-worndnet-index
10
+ reader:
11
+ _target_: wsl.reader.pytorch_modules.span.WSLReaderForSpanExtraction
12
+ transformer_model: Babelscape/wsl-reader-deberta-v3-base
13
+ task: SPAN
14
+ metadata_fields: []
15
+ top_k: 100
16
+ window_size: 16
17
+ window_stride: 8