d-ser-t-service
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -9,3 +9,4 @@ import { PullAudioInputStreamCallback } from 'microsoft-cognitiveservices-speech-sdk'; | ||
setFile: (fileName: string) => void; | ||
finishedSendingFile: () => boolean; | ||
} | ||
//# sourceMappingURL=MultiFilePullStream.d.ts.map |
@@ -36,2 +36,5 @@ "use strict"; | ||
}; | ||
this.finishedSendingFile = () => { | ||
return this.currentOffset >= this.currentFile.byteLength; | ||
}; | ||
} | ||
@@ -38,0 +41,0 @@ } |
@@ -141,2 +141,7 @@ "use strict"; | ||
else { | ||
if (e.result.text === '' && !stream.finishedSendingFile()) { | ||
// If we get a no-text recognition back and we haven't finished sending the file | ||
// then skip this result and wait for another one | ||
return; | ||
} | ||
// push response into the resultArray | ||
@@ -143,0 +148,0 @@ this.resultArray.push({ |
@@ -8,13 +8,7 @@ import { TestMetaData, TestResult } from './types'; | ||
*/ | ||
countNumFailures: (results: TestResult[]) => number; | ||
getFailureCount: (results: TestResult[]) => number; | ||
/** | ||
* Extracts testing time from metadata in number form. | ||
* Uses the xmlbuilder module to generate a string containing test results | ||
* and the relevant metrics in JUnit XML format for a single run. | ||
* | ||
* @param metadata Metadata of a test run | ||
*/ | ||
getNumericalTime: (metadata: TestMetaData) => number; | ||
/** | ||
* Uses the xmlbuilder module to generate a string containing test results and the | ||
* relevant metrics in JUnit XML format for a single run. | ||
* | ||
* @param metadata Metadata for the test run | ||
@@ -26,4 +20,4 @@ * @param results Results of the test run | ||
/** | ||
* Writes the test results and top-level metrics in JUnit XML format | ||
* at the specified filepath. | ||
* Writes the test results and top-level metrics in JUnit XML format at the | ||
* specified filepath. | ||
* | ||
@@ -30,0 +24,0 @@ * @param filePath Path to a .xml file |
@@ -14,3 +14,3 @@ "use strict"; | ||
*/ | ||
this.countNumFailures = (results) => { | ||
this.getFailureCount = (results) => { | ||
let count = 0; | ||
@@ -25,13 +25,5 @@ results.forEach(elem => { | ||
/** | ||
* Extracts testing time from metadata in number form. | ||
* Uses the xmlbuilder module to generate a string containing test results | ||
* and the relevant metrics in JUnit XML format for a single run. | ||
* | ||
* @param metadata Metadata of a test run | ||
*/ | ||
this.getNumericalTime = (metadata) => { | ||
return parseInt(metadata.totalTestingTime, 10); | ||
}; | ||
/** | ||
* Uses the xmlbuilder module to generate a string containing test results and the | ||
* relevant metrics in JUnit XML format for a single run. | ||
* | ||
* @param metadata Metadata for the test run | ||
@@ -42,37 +34,46 @@ * @param results Results of the test run | ||
this.toJunitXml = (metadata, results, timestamp) => { | ||
const numTests = results.length; | ||
const numFailures = this.countNumFailures(results); | ||
const testingTime = this.getNumericalTime(metadata); | ||
const testCount = results.length; | ||
const failureCount = this.getFailureCount(results); | ||
// Extracts testing string time from metadata in number form. | ||
const totalTestingTime = parseInt(metadata.totalTestingTime, 10); | ||
const testsuites = builder | ||
.create('testsuites', { encoding: 'utf-8' }) | ||
// d-ser-t-specific attributes. | ||
.att('SER', metadata.sentenceErrorRate) | ||
.att('AWER', metadata.averageWordErrorRate) | ||
// JUNIT attributes. | ||
.att('name', 'CRIS STT tests') | ||
.att('tests', numTests) | ||
.att('failures', numFailures) | ||
.att('time', testingTime) | ||
.att('avg_SER', metadata.sentenceErrorRate) | ||
.att('avg_WER', metadata.averageWordErrorRate); | ||
.att('tests', testCount) | ||
.att('failures', failureCount) | ||
.att('time', totalTestingTime); | ||
const testsuite = testsuites | ||
.ele('testsuite') | ||
// d-ser-t-specific attributes. | ||
.att('SER', metadata.sentenceErrorRate) | ||
.att('AWER', metadata.averageWordErrorRate) | ||
// JUNIT attributes. | ||
.att('name', metadata.transcriptionFile) | ||
.att('tests', testCount) | ||
.att('failures', failureCount) | ||
.att('time', totalTestingTime) | ||
.att('timestamp', timestamp) | ||
.att('errors', 0) | ||
.att('failures', numFailures) | ||
.att('skipped', 0) | ||
.att('timestamp', timestamp) | ||
.att('time', testingTime) | ||
.att('tests', numTests) | ||
.att('SER', metadata.sentenceErrorRate) | ||
.att('avg_WER', metadata.averageWordErrorRate); | ||
results.forEach((tc, index) => { | ||
const filename = path.parse(metadata.transcriptionFile).base; | ||
.att('skipped', 0); | ||
results.forEach((result, index) => { | ||
const testcase = testsuite | ||
.ele('testcase') | ||
// JUNIT attributes. | ||
.att('classname', `test-${index + 1}`) | ||
.att('name', filename) | ||
.att('time', 'n/a') | ||
.att('expected', tc.expectedTranscription); | ||
if (tc.wordErrorRate > 0) { | ||
// d-ser-t-specific attributes. | ||
.att('WER', result.wordErrorRate) | ||
.att('expected', result.expectedTranscription) | ||
// JUNIT attributes. | ||
.att('name', 'N/A') | ||
.att('time', 'N/A'); | ||
if (result.wordErrorRate > 0) { | ||
testcase | ||
// JUNIT attributes. | ||
.ele('failure') | ||
.att('actual', tc.actualTranscription) | ||
.att('WER', tc.wordErrorRate) | ||
// d-ser-t-specific attributes. | ||
.att('actual', result.actualTranscription) | ||
.end({ pretty: true }); | ||
@@ -87,4 +88,4 @@ } | ||
/** | ||
* Writes the test results and top-level metrics in JUnit XML format | ||
* at the specified filepath. | ||
* Writes the test results and top-level metrics in JUnit XML format at the | ||
* specified filepath. | ||
* | ||
@@ -91,0 +92,0 @@ * @param filePath Path to a .xml file |
{ | ||
"name": "d-ser-t-service", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "Dynamic Sentence Error Rate Testing: A Package for testing the CRIS speech-to-text model, quantifying the quality of the model with respect to its Word Error Rate", | ||
@@ -60,3 +60,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "a24f047377f3c017304db612131779c5af1f8807" | ||
"gitHead": "53a9779b08d2988a49ea77e5ef4fe465235dc5be" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
102137
1254