asahi417 commited on
Commit
c9707af
1 Parent(s): b496325
Files changed (1) hide show
  1. relational_similarity.py +11 -11
relational_similarity.py CHANGED
@@ -3,9 +3,9 @@ from itertools import combinations
3
  import datasets
4
 
5
  logger = datasets.logging.get_logger(__name__)
6
- _DESCRIPTION = """"""
7
  _NAME = "relational_similarity"
8
- _VERSION = "0.0.0"
9
  _CITATION = """TBA"""
10
 
11
  _HOME_PAGE = "https://github.com/asahi417/relbert"
@@ -22,13 +22,11 @@ for n in range(2, len(_DATA_ALL) + 1):
22
  _ALL_TYPES = [sorted(i) for i in _ALL_TYPES]
23
  _ALL_TYPES_DICT = {'.'.join(i): i for i in _ALL_TYPES}
24
  _URLS = {
25
- str(datasets.Split.TRAIN): {
26
- k: [f'{_URL}/{_v}.train.jsonl' for _v in v] for k, v in _ALL_TYPES_DICT.items(),
27
- },
28
- str(datasets.Split.VALIDATION): {
29
- k: [f'{_URL}/{_v}.validation.jsonl' for _v in v] for k, v in _ALL_TYPES_DICT.items(),
30
  }
31
- }
32
 
33
 
34
  class RelationalSimilarityConfig(datasets.BuilderConfig):
@@ -46,12 +44,14 @@ class NELLNetRelationalSimilarity(datasets.GeneratorBasedBuilder):
46
  """Dataset."""
47
 
48
  BUILDER_CONFIGS = [
49
- RelationalSimilarityConfig(name=_NAME, version=datasets.Version(_VERSION), description=_DESCRIPTION),
 
50
  ]
51
 
52
  def _split_generators(self, dl_manager):
53
- downloaded_file = dl_manager.download_and_extract(_URLS)
54
- return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[i]}) for i in _URLS.keys()]
 
55
 
56
  def _generate_examples(self, filepaths):
57
  _key = 0
 
3
  import datasets
4
 
5
  logger = datasets.logging.get_logger(__name__)
6
+ _DESCRIPTION = """TBA"""
7
  _NAME = "relational_similarity"
8
+ _VERSION = "0.0.1"
9
  _CITATION = """TBA"""
10
 
11
  _HOME_PAGE = "https://github.com/asahi417/relbert"
 
22
  _ALL_TYPES = [sorted(i) for i in _ALL_TYPES]
23
  _ALL_TYPES_DICT = {'.'.join(i): i for i in _ALL_TYPES}
24
  _URLS = {
25
+ k: {
26
+ str(datasets.Split.TRAIN): [f'{_URL}/{_v}.train.jsonl' for _v in v],
27
+ str(datasets.Split.VALIDATION): [f'{_URL}/{_v}.validation.jsonl' for _v in v],
 
 
28
  }
29
+ for k, v in _ALL_TYPES_DICT.items()}
30
 
31
 
32
  class RelationalSimilarityConfig(datasets.BuilderConfig):
 
44
  """Dataset."""
45
 
46
  BUILDER_CONFIGS = [
47
+ RelationalSimilarityConfig(name=i, version=datasets.Version(_VERSION), description=_DESCRIPTION)
48
+ for i in sorted(_ALL_TYPES_DICT.keys())
49
  ]
50
 
51
  def _split_generators(self, dl_manager):
52
+ downloaded_file = dl_manager.download_and_extract(_URLS[self.config.name])
53
+ return [datasets.SplitGenerator(name=i, gen_kwargs={"filepaths": downloaded_file[str(i)]})
54
+ for i in [datasets.Split.TRAIN, datasets.Split.VALIDATION]]
55
 
56
  def _generate_examples(self, filepaths):
57
  _key = 0