asahi417 commited on
Commit
dbb440e
1 Parent(s): 4face1f
Files changed (3) hide show
  1. README.md +7 -0
  2. data.jsonl +20 -0
  3. relation_mapping.py +76 -0
README.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {"id": "m10",
2
+ "reference": ["seeing", "understanding"],
3
+ "source": ["seeing", "light", "illuminating", "darkness", "view", "hidden"],
4
+ "target": ["understanding", "knowledge", "explaining", "confusion", "interpretation", "secret"],
5
+ "agreement": [68.2, 77.3, 86.4, 86.4, 68.2, 86.4],
6
+ "pos": ["vbg", "nn", "vbg", "nn", "nn", "jj"],
7
+ "target_random": ["knowledge", "interpretation", "explaining", "confusion", "understanding", "secret"]}
data.jsonl ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {"id": "a1", "reference": ["solar system", "atom"], "source": ["solar system", "sun", "planet", "mass", "attracts", "revolves", "gravity"], "target": ["atom", "nucleus", "electron", "charge", "attracts", "revolves", "electromagnetism"], "agreement": [86.4, 100.0, 95.5, 86.4, 90.9, 95.5, 81.8], "pos": ["nn", "nn", "nn", "nn", "vbz", "vbz", "nn"], "target_random": ["electron", "revolves", "nucleus", "attracts", "atom", "charge", "electromagnetism"]}
2
+ {"id": "a2", "reference": ["water flow", "heat transfer"], "source": ["water", "flows", "pressure", "water tower", "bucket", "filling", "emptying", "hydrodynamics"], "target": ["heat", "transfers", "temperature", "burner", "kettle", "heating", "cooling", "thermodynamics"], "agreement": [86.4, 95.5, 86.4, 72.7, 72.7, 95.5, 95.5, 90.9], "pos": ["nn", "vbz", "nn", "nn", "nn", "vbg", "vbg", "nn"], "target_random": ["burner", "kettle", "cooling", "heating", "transfers", "thermodynamics", "temperature", "heat"]}
3
+ {"id": "a3", "reference": ["waves", "sounds"], "source": ["waves", "shore", "reflects", "water", "breakwater", "rough", "calm", "crashing"], "target": ["sounds", "wall", "echoes", "air", "insulation", "loud", "quiet", "vibrating"], "agreement": [86.4, 77.3, 95.5, 95.5, 81.8, 63.6, 100.0, 54.5], "pos": ["nns", "nn", "vbz", "nn", "nn", "jj", "jj", "vbg"], "target_random": ["quiet", "wall", "loud", "echoes", "vibrating", "sounds", "air", "insulation"]}
4
+ {"id": "a4", "reference": ["combustion", "respiration"], "source": ["combustion", "fire", "fuel", "burning", "hot", "intense", "oxygen", "carbon dioxide"], "target": ["respiration", "animal", "food", "breathing", "living", "vigorous", "oxygen", "carbon dioxide"], "agreement": [72.7, 95.5, 90.9, 72.7, 59.1, 77.3, 77.3, 86.4], "pos": ["nn", "nn", "nn", "vbg", "jj", "jj", "nn", "nn"], "target_random": ["living", "oxygen", "food", "vigorous", "animal", "carbon dioxide", "respiration", "breathing"]}
5
+ {"id": "a5", "reference": ["sound", "light"], "source": ["sound", "low", "high", "echoes", "loud", "quiet", "horn"], "target": ["light", "red", "violet", "reflects", "bright", "dim", "lens"], "agreement": [86.4, 50.0, 4.5, 100.0, 90.9, 77.3, 95.5], "pos": ["nn", "jj", "jj", "vbz", "jj", "jj", "nn"], "target_random": ["bright", "dim", "light", "reflects", "red", "violet", "lens"]}
6
+ {"id": "a6", "reference": ["projectile", "planet"], "source": ["projectile", "trajectory", "earth", "parabolic", "air", "gravity", "attracts"], "target": ["planet", "orbit", "sun", "elliptical", "space", "gravity", "attracts"], "agreement": [100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 90.9, 90.9], "pos": ["nn", "nn", "nn", "jj", "nn", "nn", "vbz"], "target_random": ["gravity", "space", "elliptical", "orbit", "attracts", "planet", "sun"]}
7
+ {"id": "a7", "reference": ["artificial selection", "natural selection"], "source": ["breeds", "selection", "conformance", "artificial", "popularity", "breeding", "domesticated"], "target": ["species", "competition", "adaptation", "natural", "fitness", "mating", "wild"], "agreement": [100.0, 59.1, 59.1, 77.3, 54.5, 95.5, 77.3], "pos": ["nns", "nn", "nn", "jj", "nn", "vbg", "jj"], "target_random": ["fitness", "natural", "wild", "species", "mating", "competition", "adaptation"]}
8
+ {"id": "a8", "reference": ["billiard balls", "gas molecules"], "source": ["ball", "billiards", "speed", "table", "bouncing", "moving", "slow", "fast"], "target": ["molecules", "gas", "temperature", "container", "pressing", "moving", "cold", "hot"], "agreement": [90.9, 72.7, 81.8, 95.5, 77.3, 86.4, 100.0, 100.0], "pos": ["nns", "nn", "nn", "nn", "vbg", "vbg", "jj", "jj"], "target_random": ["gas", "container", "moving", "hot", "molecules", "pressing", "cold", "temperature"]}
9
+ {"id": "a9", "reference": ["computer", "mind"], "source": ["computer", "processing", "erasing", "write", "read", "memory", "outputs", "inputs", "bug"], "target": ["mind", "thinking", "forgetting", "memorize", "remember", "memory", "muscles", "senses", "mistake"], "agreement": [90.9, 95.5, 100.0, 72.7, 54.5, 81.8, 72.7, 90.9, 100.0], "pos": ["nn", "vbg", "vbg", "vb", "vb", "nn", "nns", "nns", "nn"], "target_random": ["memorize", "forgetting", "remember", "mistake", "memory", "senses", "muscles", "thinking", "mind"]}
10
+ {"id": "a10", "reference": ["slot machines", "bacterial mutation"], "source": ["slot machines", "reels", "spinning", "winning", "losing"], "target": ["bacteria", "genes", "mutating", "reproducing", "dying"], "agreement": [68.2, 72.7, 86.4, 90.9, 100.0], "pos": ["nns", "nns", "vbg", "vbg", "vbg"], "target_random": ["bacteria", "reproducing", "dying", "genes", "mutating"]}
11
+ {"id": "m1", "reference": ["war", "argument"], "source": ["war", "soldier", "destroy", "fighting", "defeat", "attacks", "weapon"], "target": ["argument", "debater", "refute", "arguing", "acceptance", "criticizes", "logic"], "agreement": [90.9, 100.0, 90.9, 95.5, 90.9, 95.5, 90.9], "pos": ["nn", "nn", "vb", "vbg", "nn", "vbg", "nn"], "target_random": ["argument", "arguing", "debater", "criticizes", "acceptance", "refute", "logic"]}
12
+ {"id": "m2", "reference": ["buying an item", "accepting a belief"], "source": ["buyer", "merchandise", "buying", "selling", "returning", "valuable", "worthless"], "target": ["believer", "belief", "accepting", "advocating", "rejecting", "true", "false"], "agreement": [100.0, 90.9, 95.5, 100.0, 95.5, 95.5, 95.5], "pos": ["nn", "nn", "vbg", "vbg", "vbg", "jj", "jj"], "target_random": ["advocating", "accepting", "false", "believer", "belief", "rejecting", "true"]}
13
+ {"id": "m3", "reference": ["grounds for a building", "reasons for a theory"], "source": ["foundations", "buildings", "supporting", "solid", "weak", "crack"], "target": ["reasons", "theories", "confirming", "rational", "dubious", "flaw"], "agreement": [72.7, 77.3, 95.5, 90.9, 95.5, 95.5], "pos": ["nns", "nns", "vbg", "jj", "jj", "nn"], "target_random": ["theories", "reasons", "dubious", "confirming", "flaw", "rational"]}
14
+ {"id": "m4", "reference": ["impediments to travel", "difficulties"], "source": ["obstructions", "destination", "route", "traveller", "traveling", "companion", "arriving"], "target": ["difficulties", "goal", "plan", "person", "problem solving", "partner", "succeeding"], "agreement": [100.0, 100.0, 100.0, 100.0, 100.0, 100.0, 100.0], "pos": ["nns", "nn", "nn", "nn", "vbg", "nn", "vbg"], "target_random": ["difficulties", "problem solving", "succeeding", "goal", "plan", "person", "partner"]}
15
+ {"id": "m5", "reference": ["money", "time"], "source": ["money", "allocate", "budget", "effective", "cheap", "expansive"], "target": ["time", "invest", "schedule", "efficient", "quick", "slow"], "agreement": [95.5, 86.4, 86.4, 86.4, 50.0, 59.1], "pos": ["nn", "vb", "nn", "jj", "jj", "jj", "jj", "jj"], "target_random": ["quick", "invest", "slow", "efficient", "schedule", "time"]}
16
+ {"id": "m6", "reference": ["seeds", "idea"], "source": ["seeds", "planted", "fruitful", "fruit", "grow", "wither", "blossom"], "target": ["ideas", "inspired", "productive", "product", "develop", "fail", "succeed"], "agreement": [90.9, 95.5, 81.8, 95.5, 81.8, 100.0, 77.3], "pos": ["nns", "vbd", "jj", "nn", "vb", "vb", "vb"], "target_random": ["develop", "succeed", "fail", "ideas", "productive", "product", "inspired"]}
17
+ {"id": "m7", "reference": ["machine", "mind"], "source": ["machine", "working", "turned on", "turned off", "broken", "power", "repair"], "target": ["mind", "thinking", "awake", "asleep", "confused", "intelligence", "therapy"], "agreement": [95.5, 100.0, 100.0, 100.0, 100.0, 95.5, 100.0], "pos": ["nn", "vbg", "jj", "jj", "jj", "nn", "nn"], "target_random": ["intelligence", "thinking", "mind", "confused", "therapy", "awake", "asleep"]}
18
+ {"id": "m8", "reference": ["object", "idea"], "source": ["object", "hold", "weight", "heavy", "light"], "target": ["idea", "understand", "analyze", "important", "trivial"], "agreement": [90.9, 81.8, 81.8, 95.5, 95.5], "pos": ["nn", "vb", "vb", "jj", "jj"], "target_random": ["idea", "analyze", "trivial", "understand", "important"]}
19
+ {"id": "m9", "reference": ["following", "understanding"], "source": ["follow", "leader", "path", "follower", "lost", "wanders", "twisted", "straight"], "target": ["understand", "speaker", "argument", "listener", "misunderstood", "digresses", "complicated", "simple"], "agreement": [100.0, 100.0, 100.0, 100.0, 86.4, 90.9, 95.5, 100.0], "pos": ["vb", "nn", "nn", "nn", "jj", "vbz", "jj", "jj"], "target_random": ["understand", "simple", "argument", "listener", "misunderstood", "complicated", "speaker", "digresses"]}
20
+ {"id": "m10", "reference": ["seeing", "understanding"], "source": ["seeing", "light", "illuminating", "darkness", "view", "hidden"], "target": ["understanding", "knowledge", "explaining", "confusion", "interpretation", "secret"], "agreement": [68.2, 77.3, 86.4, 86.4, 68.2, 86.4], "pos": ["vbg", "nn", "vbg", "nn", "nn", "jj"], "target_random": ["knowledge", "interpretation", "explaining", "confusion", "understanding", "secret"]}
relation_mapping.py ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import datasets
3
+
4
+ logger = datasets.logging.get_logger(__name__)
5
+ _DESCRIPTION = """[Relation Mapping](https://www.jair.org/index.php/jair/article/view/10583)"""
6
+ _NAME = "Relation Mapping"
7
+ _VERSION = "1.0.0"
8
+ _CITATION = """
9
+ @article{turney2008latent,
10
+ title={The latent relation mapping engine: Algorithm and experiments},
11
+ author={Turney, Peter D},
12
+ journal={Journal of Artificial Intelligence Research},
13
+ volume={33},
14
+ pages={615--655},
15
+ year={2008}
16
+ }
17
+ """
18
+
19
+ _HOME_PAGE = "https://github.com/asahi417/relbert"
20
+ _URLS = {
21
+ str(datasets.Split.TEST): [f'https://huggingface.co/datasets/relbert/{_NAME}/raw/main/data.jsonl']
22
+ }
23
+
24
+
25
+ class RelationMappingConfig(datasets.BuilderConfig):
26
+ """BuilderConfig"""
27
+
28
+ def __init__(self, **kwargs):
29
+ """BuilderConfig.
30
+ Args:
31
+ **kwargs: keyword arguments forwarded to super.
32
+ """
33
+ super(RelationMappingConfig, self).__init__(**kwargs)
34
+
35
+
36
+ class RelationMapping(datasets.GeneratorBasedBuilder):
37
+ """Dataset."""
38
+
39
+ BUILDER_CONFIGS = [
40
+ RelationMappingConfig(name=_NAME, version=datasets.Version(_VERSION), description=_DESCRIPTION),
41
+ ]
42
+
43
+ def _split_generators(self, dl_manager):
44
+ downloaded_file = dl_manager.download_and_extract(_URLS)
45
+ return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[str(i)]})
46
+ for i in [datasets.Split.TRAIN, datasets.Split.VALIDATION]]
47
+
48
+ def _generate_examples(self, filepaths):
49
+ _key = 0
50
+ for filepath in filepaths:
51
+ logger.info(f"generating examples from = {filepath}")
52
+ with open(filepath, encoding="utf-8") as f:
53
+ _list = [i for i in f.read().split('\n') if len(i) > 0]
54
+ for i in _list:
55
+ data = json.loads(i)
56
+ yield _key, data
57
+ _key += 1
58
+
59
+ def _info(self):
60
+ return datasets.DatasetInfo(
61
+ description=_DESCRIPTION,
62
+ features=datasets.Features(
63
+ {
64
+ "id": datasets.Value("string"),
65
+ "reference": datasets.Sequence(datasets.Sequence(datasets.Value("string"))),
66
+ "source": datasets.Sequence(datasets.Value("string")),
67
+ "target": datasets.Sequence(datasets.Value("string")),
68
+ "agreement": datasets.Sequence(datasets.Value("float32")),
69
+ "pos": datasets.Sequence(datasets.Value("string")),
70
+ "target_random": datasets.Sequence(datasets.Value("string")),
71
+ }
72
+ ),
73
+ supervised_keys=None,
74
+ homepage=_HOME_PAGE,
75
+ citation=_CITATION,
76
+ )