readme
Browse files- README.md +41 -0
- data/data_processed.new.validation.jsonl +5 -0
- relentless.py +71 -0
README.md
ADDED
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- en
|
4 |
+
license:
|
5 |
+
- other
|
6 |
+
multilinguality:
|
7 |
+
- monolingual
|
8 |
+
size_categories:
|
9 |
+
- n<1K
|
10 |
+
pretty_name: TBA
|
11 |
+
---
|
12 |
+
|
13 |
+
# Dataset Card for "cardiffnlp/relentless"
|
14 |
+
## Dataset Description
|
15 |
+
- **Repository:** [https://huggingface.co/datasets/cardiffnlp/relentless](https://huggingface.co/datasets/cardiffnlp/relentless)
|
16 |
+
- **Paper:** TBA
|
17 |
+
- **Dataset:**
|
18 |
+
|
19 |
+
### Dataset Summary
|
20 |
+
|
21 |
+
|
22 |
+
| relation_type | val. | test |
|
23 |
+
|:-----------------------|-------:|-------:|
|
24 |
+
| is friend/ally of | 20 | 92 |
|
25 |
+
| is competitor/rival of | 20 | 89 |
|
26 |
+
| is known for | 20 | 108 |
|
27 |
+
| is influenced by | 20 | 93 |
|
28 |
+
| is similar to | 20 | 93 |
|
29 |
+
|
30 |
+
## Dataset Structure
|
31 |
+
### Data Instances
|
32 |
+
|
33 |
+
|
34 |
+
### Citation Information
|
35 |
+
```
|
36 |
+
TBA
|
37 |
+
```
|
38 |
+
|
39 |
+
### LICENSE
|
40 |
+
The LICENSE of all the resources are under [CC-BY-NC-4.0](./LICENSE). Thus, they are freely available for academic purpose or individual research, but restricted for commercial use.
|
41 |
+
|
data/data_processed.new.validation.jsonl
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{"pairs": [["Nadal", "Federer"], ["Virgin Media", "BT"], ["UNIQLO", "ZARA"], ["The Notorious B.I.G.", "2Pac"], ["AC Milan", "Juventus"], ["University of Oxford", "University of Cambridge"], ["Red Hat", "Ubuntu"], ["Borussia Dortmund", "PSG"], ["Cardiff FC", "Swansea FC"], ["Microsoft", "Facebook"], ["Doctor Who", "Game of Thrones"], ["Macallan", "Suntory"], ["Christopher Lloyd", "Coriandrum sativum"], ["Wickes", "ScrewFix"], ["EE", "Three UK"], ["US", "Mexico"], ["Marvel Comics", "D.C. Comics"], ["Betty White", "Charli D'Amelio"], ["Salieri", "Mozart"], ["Russia", "US"]], "scores_all": [[5.0, 4.0, 5.0, 5.0, 4.0, 4.0, 5.0], [5.0, 5.0, 4.0, 4.0, 5.0, 5.0, 5.0], [4.0, 4.0, 5.0, 3.0, 5.0, 3, 4.0], [4.0, 1, 5.0, 5.0, 4.0, 4.0, 5.0], [5.0, 5.0, 5.0, 5.0, 5.0, 4.0, 5.0], [4.0, 5.0, 4.0, 4.0, 4.0, 4.0, 5.0], [4.0, 3.0, 4.0, 4.0, 5.0, 3, 5.0], [4.0, 5.0, 3.0, 4.0, 5.0, 4.0, 3.0], [4.0, 5.0, 5.0, 5.0, 5.0, 4.0, 5.0], [3.0, 2, 4.0, 4.0, 5.0, 3.0, 4.0], [3.0, 4.0, 2, 2.0, 3.0, 4.0, 2.0], [4, 3, 3.0, 4.0, 4.0, 5.0, 5.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [4.0, 3.0, 5.0, 4.0, 4.0, 5.0, 5.0], [4.0, 5.0, 3.0, 5.0, 5.0, 5.0, 5.0], [3.0, 4.0, 3.0, 2.0, 4.0, 3, 2.0], [4.0, 5.0, 5.0, 5.0, 5, 5.0, 5.0], [1.0, 1.0, 1.0, 2.0, 1.0, 1.0, 1.0], [4, 2.0, 4.0, 4.0, 2.0, 3.0, 2.0], [5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0]], "scores_mean": [4.571428571428571, 4.714285714285714, 4.0, 4.0, 4.857142857142857, 4.285714285714286, 4.0, 4.0, 4.714285714285714, 3.5714285714285716, 2.857142857142857, 4.0, 1.0, 4.285714285714286, 4.571428571428571, 3.0, 4.857142857142857, 1.1428571428571428, 3.0, 5.0], "relation_type": "is competitor/rival of", "ranks": [6.5, 4.5, 12, 12, 2.5, 8.5, 12, 12, 4.5, 15, 18, 12, 20, 8.5, 6.5, 16.5, 2.5, 19, 16.5, 1], "positive_examples": [["Aznar", "Bush"], ["Sprite", "7 Up"], ["Cadbury", "chocolate"], ["Plato", "Socrates"], ["Ligue 1", "Bundesliga"]]}
|
2 |
+
{"pairs": [["Owain Glyndwr", "Charles VI of France"], ["United States", "European Union"], ["UK", "USA"], ["Thomas Carlyle", "Charles Dickens"], ["Abraham Lincoln", "George McLellan"], ["Ukraine", "Russia"], ["Russia", "Belarus"], ["Darth Vader", "Obi-Wan Kenobi"], ["Donald Trump", "Ron DeSantis"], ["Microsoft", "OpenAI"], ["Frodo", "Boromir"], ["Lady Gaga", "Madonna"], ["England", "Scotland"], ["Vincent van Gogh", "Paul Gauguin"], ["Gatsby", "Tom Buchanan"], ["UK", "Rwanda"], ["Maximus Decimus Meridius", "Juba"], ["CIA", "MI6"], ["Sherlock", "Lauryn Hill"], ["Schindler's List", "Baz Luhrmann"]], "scores_all": [[4.0, 5, 5.0, 3.0, 3.0, 5.0, 4.0], [4.0, 4.0, 5.0, 4.0, 5.0, 5.0, 4.0], [4.0, 5.0, 5.0, 5.0, 5, 5.0, 5.0], [4.0, 4.0, 5.0, 5.0, 4.0, 3.0, 4.0], [2.0, 1.0, 2.0, 2, 2.0, 1.0, 2.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0], [2.0, 1.0, 1.0, 3, 2.0, 2.0, 1.0], [3.0, 3.0, 2.0, 4.0, 2.0, 3, 4.0], [5.0, 5.0, 4.0, 4.0, 4.0, 5.0, 4.0], [3.0, 1, 4.0, 4.0, 4, 5.0, 5.0], [3.0, 4.0, 1, 2.0, 4.0, 2.0, 2.0], [4.0, 4.0, 4.0, 4.0, 5.0, 3.0, 4.0], [4, 4.0, 3.0, 2, 5.0, 4.0, 5.0], [2, 1.0, 1.0, 2.0, 2.0, 1.0, 1.0], [3.0, 3.0, 2.0, 4.0, 3.0, 3.0, 3.0], [4.0, 5, 5, 4.0, 5, 4, 5], [4.0, 4.0, 5.0, 5.0, 5.0, 4.0, 5.0], [1.0, 1.0, 1.0, 3.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 3.0, 1.0, 1.0, 2.0]], "scores_mean": [4.142857142857143, 4.428571428571429, 4.857142857142857, 4.142857142857143, 1.7142857142857142, 1.0, 5.0, 1.7142857142857142, 3.0, 4.428571428571429, 3.7142857142857144, 2.5714285714285716, 4.0, 3.857142857142857, 1.4285714285714286, 3.0, 4.571428571428571, 4.571428571428571, 1.2857142857142858, 1.4285714285714286], "relation_type": "is friend/ally of", "ranks": [7.5, 5.5, 2, 7.5, 15.5, 20, 1, 15.5, 12.5, 5.5, 11, 14, 9, 10, 17.5, 12.5, 3.5, 3.5, 19, 17.5], "positive_examples": [["Australia", "New Zealand"], ["Dell", "HP"], ["Russell Crowe", "Gladiator"], ["Europe", "European Union"], ["Coca-Cola", "Pepsi"]]}
|
3 |
+
{"pairs": [["Oasis", "Beatles"], ["Vincent van gogh", "Bipolar disorder"], ["UK", "Winston Churchill"], ["The Hunger Games", "1984"], ["Acer", "Asus"], ["Vape", "cigarette"], ["Pulp", "Beatles"], ["Buckingham Palace", "Accenture"], ["Chester Bennington", "Jonathan Banks"], ["Mike Tyson", "Muhammad Ali"], ["English Wikipedia", "Alexandra Feodorovna"], ["Liz Truss", "Thatcher"], ["Conservative Party", "Labour Party"], ["Vladimir Lenin", "Karl Marx"], ["Europe", "European Union"], ["UK", "EU"], ["McDonalds", "KFC"], ["Boris Johnson", "Winston Churchill"], ["Rihanna", "Stevie Wonder"], ["Rhys Ifans", "Richard Branson"]], "scores_all": [[4.0, 4.0, 5.0, 5.0, 5.0, 4.0, 5.0], [4.0, 1, 2.0, 4.0, 5.0, 4.0, 5.0], [4.0, 5.0, 3.0, 5.0, 5.0, 4.0, 5.0], [4.0, 5.0, 3.0, 4.0, 4.0, 4.0, 4.0], [4.0, 5.0, 3.0, 4.0, 5.0, 3.0, 5.0], [4.0, 5.0, 3.0, 5.0, 5.0, 5.0, 5.0], [4.0, 2.0, 3.0, 4.0, 5.0, 2, 3.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 2, 1.0, 3.0, 1.0, 1.0, 1.0], [4.0, 5.0, 3.0, 4.0, 5.0, 5.0, 3.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0], [4.0, 5.0, 4.0, 5.0, 5.0, 4.0, 5.0], [3.0, 5.0, 3.0, 4.0, 5.0, 3.0, 4.0], [4.0, 5.0, 5.0, 5.0, 4.0, 4.0, 5.0], [4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0], [4.0, 5.0, 4.0, 5.0, 5.0, 5.0, 5.0], [4, 5.0, 3.0, 4.0, 5.0, 4.0, 5], [4.0, 5.0, 4.0, 5.0, 5.0, 4.0, 5.0], [2.0, 2.0, 2.0, 4.0, 4.0, 4.0, 3.0], [2.0, 1.0, 1.0, 2.0, 1.0, 1.0, 1.0]], "scores_mean": [4.571428571428571, 3.5714285714285716, 4.428571428571429, 4.0, 4.142857142857143, 4.571428571428571, 3.2857142857142856, 1.0, 1.4285714285714286, 4.142857142857143, 1.0, 4.571428571428571, 3.857142857142857, 4.571428571428571, 4.857142857142857, 4.714285714285714, 4.285714285714286, 4.571428571428571, 3.0, 1.2857142857142858], "relation_type": "is influenced by", "ranks": [5, 14, 8, 12, 10.5, 5, 15, 19.5, 17, 10.5, 19.5, 5, 13, 5, 1, 2, 9, 5, 16, 18], "positive_examples": [["Elsa", "Anna"], ["Liverpool FC", "Manchester United"], ["Leonardo Da Vinci", "Mona Lisa"], ["Messi", "Maradona"], ["The Avengers", "The Justice League"]]}
|
4 |
+
{"pairs": [["Le Corbusier", "purism art"], ["Sean Connery", "Finding Forrester"], ["Russell Crowe", "Gladiator"], ["Qualcomm", "smartphones"], ["Adam Driver", "Hannibal Lecter"], ["Scotland", "bagpipes"], ["Mount Everest", "New Testament"], ["Bosch", "dishwasher"], ["Cadbury", "chocolate"], ["John Krasinski", "Tony Curtis"], ["Ernest Hemingway", "To Have and Have Not"], ["Italy", "pizza"], ["Chris Hemsworth", "Blackbeard"], ["Snap", "Snapchat"], ["Father's Day", "Shirley Temple"], ["Rome", "Colosseum"], ["Jared Leto", "Steve Irwin"], ["Bill Gates", "Microsoft"], ["Nikola Tesla", "robotics"], ["New Zealand", "sheep"]], "scores_all": [[4.0, 5.0, 3.0, 4.0, 5.0, 3.0, 5.0], [4.0, 5.0, 2, 5.0, 5.0, 4.0, 2], [4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0], [3.0, 3, 2, 3, 2, 2, 2], [1.0, 5, 1.0, 2.0, 1.0, 3.0, 1.0], [4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0], [2.0, 1.0, 1.0, 1, 1.0, 1.0, 1.0], [4.0, 3.0, 3.0, 2.0, 4.0, 2.0, 3.0], [5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0], [1.0, 2.0, 1.0, 3.0, 1.0, 1.0, 1.0], [3, 5.0, 3.0, 5.0, 4.0, 5.0, 3.0], [5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0], [2.0, 1.0, 1.0, 3.0, 3, 1.0, 1.0], [5.0, 5.0, 5.0, 4.0, 5.0, 5.0, 5.0], [1.0, 3, 1.0, 3.0, 1.0, 1.0, 3.0], [5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 4.0], [1.0, 1.0, 1.0, 3.0, 1.0, 1.0, 1.0], [4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0], [4.0, 3.0, 3.0, 4.0, 4, 4, 1], [4.0, 5.0, 4.0, 4.0, 5.0, 4.0, 3.0]], "scores_mean": [4.142857142857143, 3.857142857142857, 4.857142857142857, 2.4285714285714284, 2.0, 4.857142857142857, 1.1428571428571428, 3.0, 5.0, 1.4285714285714286, 4.0, 5.0, 1.7142857142857142, 4.857142857142857, 1.8571428571428572, 4.857142857142857, 1.2857142857142858, 4.857142857142857, 3.2857142857142856, 4.142857142857143], "relation_type": "is known for", "ranks": [8.5, 11, 5, 14, 15, 5, 20, 13, 1.5, 18, 10, 1.5, 17, 5, 16, 5, 19, 5, 12, 8.5], "positive_examples": [["Extinction Rebellion", "Greta Thunberg"], ["Israel", "Palestine"], ["Paris", "Eiffel Tower"], ["Ethereum", "Bitcoin"], ["Australia", "New Zealand"]]}
|
5 |
+
{"pairs": [["NATO", "United Nations"], ["Tesco", "Sainsburys"], ["Surrey", "Essex"], ["Squid Game", "Physical: 100"], ["Adele", "Ed Sheeran"], ["Sweden", "Finland"], ["Prada", "Versace"], ["Champions League", "Primavera Sound"], ["Christianity", "Judaism"], ["Marvel Comics", "DC Comics"], ["Doctor Who", "Sherlock Holmes"], ["Iraq", "Iran"], ["Cornwall", "Brittany"], ["The Simpsons", "Family Guy"], ["Domino's", "YO! Sushi"], ["Sukhoi Su-34", "Rita Moreno"], ["Kyivan Rus'", "Julian calendar"], ["cement", "concrete"], ["Quora", "Stack Overflow"], ["Queen", "Richard Wagner"]], "scores_all": [[4.0, 5.0, 3.0, 5.0, 5.0, 5.0, 4], [5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0], [4.0, 5.0, 5.0, 4.0, 4.0, 4.0, 5.0], [4.0, 4.0, 3.0, 4, 5.0, 4.0, 5.0], [4.0, 2.0, 4.0, 2.0, 4, 3.0, 4.0], [5.0, 4.0, 5.0, 4.0, 5.0, 5.0, 2], [4.0, 5.0, 5.0, 4.0, 5.0, 4.0, 5.0], [2.0, 1.0, 1.0, 2.0, 1.0, 1.0, 1.0], [4.0, 4.0, 4.0, 4.0, 4.0, 3.0, 2.0], [4.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0], [2.0, 2, 3.0, 2.0, 4.0, 4.0, 3.0], [4.0, 4.0, 5.0, 4.0, 3.0, 5.0, 2], [4.0, 3.0, 4.0, 4.0, 3, 5.0, 4.0], [5.0, 4.0, 5.0, 5.0, 5.0, 5.0, 5.0], [4, 1.0, 3.0, 2, 1.0, 1.0, 1.0], [1.0, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 3], [4.0, 5.0, 3.0, 2, 4.0, 5.0, 5.0], [4.0, 5.0, 4.0, 4.0, 4.0, 4.0, 4], [3.0, 3, 2.0, 2.0, 3.0, 1.0, 1.0]], "scores_mean": [4.428571428571429, 5.0, 4.428571428571429, 4.142857142857143, 3.2857142857142856, 4.285714285714286, 4.571428571428571, 1.2857142857142858, 3.5714285714285716, 4.857142857142857, 2.857142857142857, 3.857142857142857, 3.857142857142857, 4.857142857142857, 1.8571428571428572, 1.1428571428571428, 1.2857142857142858, 4.0, 4.142857142857143, 2.142857142857143], "relation_type": "is similar to", "ranks": [5.5, 1, 5.5, 8.5, 14, 7, 4, 18.5, 13, 2.5, 15, 11.5, 11.5, 2.5, 17, 20, 18.5, 10, 8.5, 16], "positive_examples": [["CIA", "MI6"], ["Microsoft Teams", "Slack"], ["Apple", "iPhone"], ["Impressionism", "Edouard Manet"], ["Tesco", "Sainsburys"]]}
|
relentless.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""
|
2 |
+
from datasets import load_dataset
|
3 |
+
data = load_dataset(".")
|
4 |
+
"""
|
5 |
+
import json
|
6 |
+
import datasets
|
7 |
+
|
8 |
+
|
9 |
+
logger = datasets.logging.get_logger(__name__)
|
10 |
+
_DESCRIPTION = """ Named-entities Relation Ranking. """
|
11 |
+
_NAME = "relentless"
|
12 |
+
_VERSION = "0.1.2"
|
13 |
+
_CITATION = """TBA"""
|
14 |
+
_HOME_PAGE = "https://huggingface.co/datasets/cardiffnlp/relentless"
|
15 |
+
_URL = f'https://huggingface.co/datasets/cardiffnlp/{_NAME}/raw/main'
|
16 |
+
_URLS = {
|
17 |
+
str(datasets.Split.VALIDATION): [f'{_URL}/data/data_processed.new.validation.jsonl'],
|
18 |
+
# str(datasets.Split.TEST): [f'{_URL}/data/data_processed.new.test.jsonl']
|
19 |
+
}
|
20 |
+
|
21 |
+
|
22 |
+
class RelentlessConfig(datasets.BuilderConfig):
|
23 |
+
"""BuilderConfig"""
|
24 |
+
|
25 |
+
def __init__(self, **kwargs):
|
26 |
+
"""BuilderConfig.
|
27 |
+
Args:
|
28 |
+
**kwargs: keyword arguments forwarded to super.
|
29 |
+
"""
|
30 |
+
super(RelentlessConfig, self).__init__(**kwargs)
|
31 |
+
|
32 |
+
|
33 |
+
class Relentless(datasets.GeneratorBasedBuilder):
|
34 |
+
"""Dataset."""
|
35 |
+
|
36 |
+
BUILDER_CONFIGS = [RelentlessConfig(version=datasets.Version(_VERSION), description=_DESCRIPTION)]
|
37 |
+
|
38 |
+
def _split_generators(self, dl_manager):
|
39 |
+
# downloaded_file = dl_manager.download_and_extract(_URLS[self.config.name])
|
40 |
+
downloaded_file = dl_manager.download_and_extract(_URLS)
|
41 |
+
return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[str(i)]})
|
42 |
+
for i in [datasets.Split.VALIDATION, datasets.Split.TEST]]
|
43 |
+
|
44 |
+
def _generate_examples(self, filepaths):
|
45 |
+
_key = 0
|
46 |
+
for filepath in filepaths:
|
47 |
+
logger.info(f"generating examples from = {filepath}")
|
48 |
+
with open(filepath, encoding="utf-8") as f:
|
49 |
+
_list = [i for i in f.read().split('\n') if len(i) > 0]
|
50 |
+
for i in _list:
|
51 |
+
data = json.loads(i)
|
52 |
+
yield _key, data
|
53 |
+
_key += 1
|
54 |
+
|
55 |
+
def _info(self):
|
56 |
+
return datasets.DatasetInfo(
|
57 |
+
description=_DESCRIPTION,
|
58 |
+
features=datasets.Features(
|
59 |
+
{
|
60 |
+
"pairs": datasets.Sequence(datasets.Sequence(datasets.Value("string"))),
|
61 |
+
"scores_all": datasets.Sequence(datasets.Sequence(datasets.Value('int32'))),
|
62 |
+
"scores_mean": datasets.Sequence(datasets.Value("float32")),
|
63 |
+
"relation_type": datasets.Value("string"),
|
64 |
+
"positive_examples": datasets.Sequence(datasets.Sequence(datasets.Value("string"))),
|
65 |
+
"ranks": datasets.Sequence(datasets.Value('int32'))
|
66 |
+
}
|
67 |
+
),
|
68 |
+
supervised_keys=None,
|
69 |
+
homepage=_HOME_PAGE,
|
70 |
+
citation=_CITATION,
|
71 |
+
)
|