asahi417 commited on
Commit
1623041
·
2 Parent(s): f5759f7 c261fca

Merge branch 'main' of https://huggingface.co/datasets/relbert/t_rex_relational_similarity into main

Browse files
Files changed (1) hide show
  1. t_rex_relational_similarity.py +5 -12
t_rex_relational_similarity.py CHANGED
@@ -7,7 +7,7 @@ import datasets
7
  logger = datasets.logging.get_logger(__name__)
8
  _DESCRIPTION = """T-Rex dataset."""
9
  _NAME = "t_rex_relational_similarity"
10
- _VERSION = "0.0.2"
11
  _CITATION = """
12
  @inproceedings{elsahar2018t,
13
  title={T-rex: A large scale alignment of natural language with knowledge base triples},
@@ -19,15 +19,11 @@ _CITATION = """
19
 
20
  _HOME_PAGE = "https://github.com/asahi417/relbert"
21
  _URL = f'https://huggingface.co/datasets/relbert/{_NAME}/resolve/main/data'
22
- MIN_ENTITY_FREQ = [1, 2, 3, 4]
23
- MAX_PREDICATE_FREQ = [100, 50, 25, 10]
24
-
25
- _TYPES = [f"filter_unified.min_entity_{a}_max_predicate_{b}" for a, b in product(MIN_ENTITY_FREQ, MAX_PREDICATE_FREQ)]
26
- _URLS = {i: {
27
  str(datasets.Split.TRAIN): [f'{_URL}/{i}.train.jsonl'],
28
  str(datasets.Split.VALIDATION): [f'{_URL}/{i}.validation.jsonl'],
29
  str(datasets.Split.TEST): [f'{_URL}/filter_unified.test.jsonl']
30
- } for i in _TYPES}
31
 
32
 
33
  class TREXRelationalSimilarityConfig(datasets.BuilderConfig):
@@ -44,13 +40,10 @@ class TREXRelationalSimilarityConfig(datasets.BuilderConfig):
44
  class TREXRelationalSimilarity(datasets.GeneratorBasedBuilder):
45
  """Dataset."""
46
 
47
- BUILDER_CONFIGS = [
48
- TREXRelationalSimilarityConfig(name=i, version=datasets.Version(_VERSION), description=_DESCRIPTION)
49
- for i in sorted(_TYPES)
50
- ]
51
 
52
  def _split_generators(self, dl_manager):
53
- downloaded_file = dl_manager.download_and_extract(_URLS[self.config.name])
54
  return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[str(i)]})
55
  for i in [datasets.Split.TRAIN, datasets.Split.VALIDATION, datasets.Split.TEST]]
56
 
 
7
  logger = datasets.logging.get_logger(__name__)
8
  _DESCRIPTION = """T-Rex dataset."""
9
  _NAME = "t_rex_relational_similarity"
10
+ _VERSION = "0.0.4"
11
  _CITATION = """
12
  @inproceedings{elsahar2018t,
13
  title={T-rex: A large scale alignment of natural language with knowledge base triples},
 
19
 
20
  _HOME_PAGE = "https://github.com/asahi417/relbert"
21
  _URL = f'https://huggingface.co/datasets/relbert/{_NAME}/resolve/main/data'
22
+ _URLS = {
 
 
 
 
23
  str(datasets.Split.TRAIN): [f'{_URL}/{i}.train.jsonl'],
24
  str(datasets.Split.VALIDATION): [f'{_URL}/{i}.validation.jsonl'],
25
  str(datasets.Split.TEST): [f'{_URL}/filter_unified.test.jsonl']
26
+ }
27
 
28
 
29
  class TREXRelationalSimilarityConfig(datasets.BuilderConfig):
 
40
  class TREXRelationalSimilarity(datasets.GeneratorBasedBuilder):
41
  """Dataset."""
42
 
43
+ BUILDER_CONFIGS = [TREXRelationalSimilarityConfig(version=datasets.Version(_VERSION), description=_DESCRIPTION)]
 
 
 
44
 
45
  def _split_generators(self, dl_manager):
46
+ downloaded_file = dl_manager.download_and_extract(_URLS)
47
  return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[str(i)]})
48
  for i in [datasets.Split.TRAIN, datasets.Split.VALIDATION, datasets.Split.TEST]]
49