Commit ·
edd945d
1
Parent(s): 33b6fcd
new test
Browse files
test2.py
CHANGED
|
@@ -185,15 +185,12 @@ class TestASR(datasets.GeneratorBasedBuilder):
|
|
| 185 |
audio_data = {}
|
| 186 |
transcripts = []
|
| 187 |
key = 0
|
| 188 |
-
print(examples, keywords)
|
| 189 |
-
print(local_extracted_archive)
|
| 190 |
for path, f in files:
|
| 191 |
audio_data[path] = f.read()
|
| 192 |
with open(keywords, encoding="utf-8") as f:
|
| 193 |
next(f)
|
| 194 |
for row in f:
|
| 195 |
r = row.split("\t")
|
| 196 |
-
print(r)
|
| 197 |
path = 'examples/'+r[0]
|
| 198 |
ngram = r[1]
|
| 199 |
transcripts.append({
|
|
@@ -202,10 +199,8 @@ class TestASR(datasets.GeneratorBasedBuilder):
|
|
| 202 |
"type": "keyword"
|
| 203 |
})
|
| 204 |
with open(examples, encoding="utf-8") as f2:
|
| 205 |
-
next(f2)
|
| 206 |
for row in f2:
|
| 207 |
r = row.split("\t")
|
| 208 |
-
print(r)
|
| 209 |
path = 'examples/'+r[0]
|
| 210 |
ngram = r[1]
|
| 211 |
transcripts.append({
|
|
@@ -213,8 +208,6 @@ class TestASR(datasets.GeneratorBasedBuilder):
|
|
| 213 |
"ngram": ngram,
|
| 214 |
"type": "example"
|
| 215 |
})
|
| 216 |
-
print("AUDIO DATA: ", audio_data)
|
| 217 |
-
print("TRANSCRIPT: ", transcripts)
|
| 218 |
if audio_data and len(audio_data) == len(transcripts):
|
| 219 |
for transcript in transcripts:
|
| 220 |
audio = {"path": transcript["path"], "bytes": audio_data[transcript["path"]]}
|
|
|
|
| 185 |
audio_data = {}
|
| 186 |
transcripts = []
|
| 187 |
key = 0
|
|
|
|
|
|
|
| 188 |
for path, f in files:
|
| 189 |
audio_data[path] = f.read()
|
| 190 |
with open(keywords, encoding="utf-8") as f:
|
| 191 |
next(f)
|
| 192 |
for row in f:
|
| 193 |
r = row.split("\t")
|
|
|
|
| 194 |
path = 'examples/'+r[0]
|
| 195 |
ngram = r[1]
|
| 196 |
transcripts.append({
|
|
|
|
| 199 |
"type": "keyword"
|
| 200 |
})
|
| 201 |
with open(examples, encoding="utf-8") as f2:
|
|
|
|
| 202 |
for row in f2:
|
| 203 |
r = row.split("\t")
|
|
|
|
| 204 |
path = 'examples/'+r[0]
|
| 205 |
ngram = r[1]
|
| 206 |
transcripts.append({
|
|
|
|
| 208 |
"ngram": ngram,
|
| 209 |
"type": "example"
|
| 210 |
})
|
|
|
|
|
|
|
| 211 |
if audio_data and len(audio_data) == len(transcripts):
|
| 212 |
for transcript in transcripts:
|
| 213 |
audio = {"path": transcript["path"], "bytes": audio_data[transcript["path"]]}
|