def run():
with open('test_set.txt', 'r') as f:
try:
cur = _db.cursor()
j = 1
for line in f:
print('Processing line: {} ({})'.format(line.rstrip(), j))
cur.execute('SELECT recording.id FROM recording '+
'WHERE recording.filename=%s', (line.rstrip()+'.wav',))
recId = cur.fetchone()[0]
cur.execute('INSERT INTO evaluation_sets (eval_set, recordingId) '+
'VALUES (\'test_set\', %s)', (recId,))
j += 1
except MySQLdb.Error as e:
msg = 'Error inserting utts into set.'
log(msg, e)
raise
# finally commit if no exceptions
_db.commit()
评论列表
文章目录