cheulyop commited on
Commit
9c302db
1 Parent(s): 8e2083e

Fix os.path import

Browse files
Files changed (1) hide show
  1. ksponspeech.py +10 -11
ksponspeech.py CHANGED
@@ -14,8 +14,7 @@
14
  # limitations under the License.
15
  """The Korean Spontaneous Speech Corpus for Automatic Speech Recognition (KsponSpeech)"""
16
 
17
-
18
- from os import path
19
 
20
  import datasets
21
 
@@ -64,12 +63,12 @@ class KsponSpeech(datasets.GeneratorBasedBuilder):
64
 
65
  def _split_generators(self, dl_manager):
66
  """Returns SplitGenerators."""
67
- self.data_dir = path.abspath(path.expanduser(dl_manager.manual_dir))
68
  return [
69
  datasets.SplitGenerator(
70
  name=datasets.Split.TRAIN,
71
  gen_kwargs={
72
- "filepath": path.join(self.data_dir, "scripts/train.trn"),
73
  "split": "train",
74
  },
75
  ),
@@ -77,8 +76,8 @@ class KsponSpeech(datasets.GeneratorBasedBuilder):
77
  name=datasets.Split.TEST,
78
  gen_kwargs={
79
  "filepath": {
80
- "clean": path.join(self.data_dir, "scripts/eval_clean.trn"),
81
- "other": path.join(self.data_dir, "scripts/eval_other.trn"),
82
  },
83
  "split": "test",
84
  },
@@ -86,7 +85,7 @@ class KsponSpeech(datasets.GeneratorBasedBuilder):
86
  datasets.SplitGenerator(
87
  name=datasets.Split.VALIDATION,
88
  gen_kwargs={
89
- "filepath": path.join(self.data_dir, "scripts/dev.trn"),
90
  "split": "validation",
91
  },
92
  ),
@@ -100,17 +99,17 @@ class KsponSpeech(datasets.GeneratorBasedBuilder):
100
  ) as f2:
101
  data = "\n".join([f1.read().strip(), f2.read().strip()])
102
  for id_, row in enumerate(data.split("\n")):
103
- filepath, sentence = tuple(row.split(" :: "))
104
  yield id_, {
105
- "file": path.join(self.data_dir, filepath),
106
  "sentence": sentence,
107
  }
108
  else:
109
  with open(filepath, encoding="utf-8") as f:
110
  data = f.read().strip()
111
  for id_, row in enumerate(data.split("\n")):
112
- filepath, sentence = tuple(row.split(" :: "))
113
  yield id_, {
114
- "file": path.join(self.data_dir, filepath),
115
  "sentence": sentence,
116
  }
 
14
  # limitations under the License.
15
  """The Korean Spontaneous Speech Corpus for Automatic Speech Recognition (KsponSpeech)"""
16
 
17
+ from os.path import *
 
18
 
19
  import datasets
20
 
 
63
 
64
  def _split_generators(self, dl_manager):
65
  """Returns SplitGenerators."""
66
+ self.data_dir = abspath(expanduser(dl_manager.manual_dir))
67
  return [
68
  datasets.SplitGenerator(
69
  name=datasets.Split.TRAIN,
70
  gen_kwargs={
71
+ "filepath": join(self.data_dir, "scripts/train.trn"),
72
  "split": "train",
73
  },
74
  ),
 
76
  name=datasets.Split.TEST,
77
  gen_kwargs={
78
  "filepath": {
79
+ "clean": join(self.data_dir, "scripts/eval_clean.trn"),
80
+ "other": join(self.data_dir, "scripts/eval_other.trn"),
81
  },
82
  "split": "test",
83
  },
 
85
  datasets.SplitGenerator(
86
  name=datasets.Split.VALIDATION,
87
  gen_kwargs={
88
+ "filepath": join(self.data_dir, "scripts/dev.trn"),
89
  "split": "validation",
90
  },
91
  ),
 
99
  ) as f2:
100
  data = "\n".join([f1.read().strip(), f2.read().strip()])
101
  for id_, row in enumerate(data.split("\n")):
102
+ path, sentence = tuple(row.split(" :: "))
103
  yield id_, {
104
+ "file": join(self.data_dir, path),
105
  "sentence": sentence,
106
  }
107
  else:
108
  with open(filepath, encoding="utf-8") as f:
109
  data = f.read().strip()
110
  for id_, row in enumerate(data.split("\n")):
111
+ path, sentence = tuple(row.split(" :: "))
112
  yield id_, {
113
+ "file": join(self.data_dir, path),
114
  "sentence": sentence,
115
  }