noflm commited on
Commit
74d4e24
1 Parent(s): 11cc927

fix csv open type

Browse files
Files changed (2) hide show
  1. EliteVoiceProject.py +2 -2
  2. upstream.py +10 -4
EliteVoiceProject.py CHANGED
@@ -136,8 +136,8 @@ class EliteVoiceProject(datasets.GeneratorBasedBuilder):
136
  def _generate_examples(self, local_extracted_archive_paths, archives, meta_path):
137
  data_fields = list(self._info().features.keys())
138
  metadata = {}
139
- with open(meta_path, newline='', encoding="utf-8") as f:
140
- reader = csv.DictReader(f)
141
  for row in tqdm(reader, desc="Reading metadata..."):
142
  if not row["path"].endswith(".mp3"):
143
  row["path"] += ".mp3"
 
136
  def _generate_examples(self, local_extracted_archive_paths, archives, meta_path):
137
  data_fields = list(self._info().features.keys())
138
  metadata = {}
139
+ with open(meta_path, 'rt', newline='', encoding='utf-8') as csvfile:
140
+ reader = csv.DictReader(csvfile)
141
  for row in tqdm(reader, desc="Reading metadata..."):
142
  if not row["path"].endswith(".mp3"):
143
  row["path"] += ".mp3"
upstream.py CHANGED
@@ -43,7 +43,7 @@ def upstream(version, platform, split):
43
  raw_path = raw_transcript['path']
44
  audio_path = f'{transcript_id}_{raw_path}'
45
  transcript = {
46
- 'path': audio_path,
47
  'sentence': raw_transcript['sentence']
48
  }
49
  transcripts.append(transcript)
@@ -58,6 +58,12 @@ def upstream(version, platform, split):
58
 
59
 
60
  # Do Upstream
61
- for platform in platforms:
62
- for split in splits:
63
- upstream(version, platform, split)
 
 
 
 
 
 
 
43
  raw_path = raw_transcript['path']
44
  audio_path = f'{transcript_id}_{raw_path}'
45
  transcript = {
46
+ 'path': f"{audio_path}",
47
  'sentence': raw_transcript['sentence']
48
  }
49
  transcripts.append(transcript)
 
58
 
59
 
60
  # Do Upstream
61
+ #for platform in platforms:
62
+ # for split in splits:
63
+ # upstream(version, platform, split)
64
+
65
+ with open('./transcript/twitter/train/twitter_train_0.0.1.csv', 'rt', newline='', encoding='utf-8') as csvfile:
66
+ reader = csv.DictReader(csvfile)
67
+ raw_transcripts = [row for row in reader]
68
+ for raw_transcript in raw_transcripts:
69
+ print(raw_transcript)