Untitled
unknown
plain_text
a year ago
1.6 kB
8
Indexable
const compare_util = require("./compare_util");
const helper = require("./helper");
const commonVariable = require("./shared_fields.js");
let wordCount = 0, wordsFailed = 0, wordRecognitionRate = 0, testCaseResult = 0, wordsHighlight = "", remarks = "", triageSummary = "";
async function getComparsionData(config,input,asr){
let input_formated = compare_util.get_formated_data(input);
let asr_formated = compare_util.get_formated_data(asr);
let [insertedCount, deletedCount, replacedCount, insertedArray, deletedArray, replacedArray, wordsHighlight, triageCategories] = compare_util.get_comparison(input_formated, asr_formated, helper.isCharBased(config.testDeviceLanguage));
wordCount = data.conversation.split(" ").length;
wordsFailed = deletedCount + replacedCount;
if (wordsFailed > 0)
asrFailCases++;
else
asrPassCases++;
wordRecognitionRate = (((wordCount - wordsFailed) / wordCount) * 100).toFixed(2);
commonVariable.setWrr(wordRecognitionRate);
testCaseResult = (wordsFailed + insertedCount) === 0 ? 1 : 0;
commonVariable.setSrr(testCaseResult * 100);
if (insertedArray.length > 0)
remarks += "\nInserted -> " + insertedArray.join(" | ");
if (deletedArray.length > 0)
remarks += "\nDeleted -> " + deletedArray.join(" | ");
if (replacedArray.length > 0)
remarks += "\nReplaced -> " + replacedArray.join(" | ");
remarks = remarks.trim();
if (remarks.length == 0)
remarks = "NA";
triageSummary = triageCategories.join(" | ");
}Editor is loading...
Leave a Comment