Skip to content

Commit d923c9a

Browse files
committed
feat: return audio duration
1 parent df7db86 commit d923c9a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

examples/main/main.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ std::vector<std::vector<std::string>> read_delimited_file(const std::string &fil
881881
std::getline(ss, region, delimiter);
882882
std::getline(ss, evaluation_value, delimiter);
883883

884-
std::vector<std::string> row = {wav_filename, transcript, id, profile_id, "", language, region, evaluation_value};
884+
std::vector<std::string> row = {wav_filename, transcript, id, profile_id, "", language, region, evaluation_value, duration};
885885
file_data.push_back(row);
886886
}
887887

@@ -1106,7 +1106,7 @@ int main(int argc, char ** argv) {
11061106
for (const auto &element : csv_data) {
11071107
// Make an empty vector to store the result and confidence score
11081108
std::vector<std::vector<std::pair<std::string, float>>> scores = {};
1109-
csv_dict[element[0]] = {element[1], element[2], element[3], element[0], "", element[5], element[6], element[7]};
1109+
csv_dict[element[0]] = {element[1], element[2], element[3], element[0], "", element[5], element[6], element[7], element[8]};
11101110
csv_scores[element[0]] = scores;
11111111
params.fname_inp.push_back(element[0]);
11121112
}
@@ -1408,6 +1408,7 @@ int main(int argc, char ** argv) {
14081408
std::string language = csv_data[5];
14091409
std::string region = csv_data[6];
14101410
std::string evaluation_value = csv_data[7];
1411+
std::string duration = csv_data[8];
14111412
std::vector<std::vector<std::pair<std::string, float>>> scores = csv_scores[wav_filename];
14121413

14131414
fout << " {\n";
@@ -1419,6 +1420,7 @@ int main(int argc, char ** argv) {
14191420
fout << " \"language\": \"" << language << "\",\n";
14201421
fout << " \"region\": \"" << region << "\",\n";
14211422
fout << " \"evaluation_value\": \"" << evaluation_value << "\",\n";
1423+
fout << " \"duration\": \"" << duration << "\",\n";
14221424
fout << " \"confidence_scores\": [\n";
14231425

14241426
// Printing confidence scores

0 commit comments

Comments
 (0)