We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 77a5ace commit c3afd21Copy full SHA for c3afd21
frontend/src/utils.js
@@ -23,10 +23,14 @@ const enumValueToName = (obj, value) => {
23
return Object.keys(obj)[Object.values(obj).findIndex(x => x === value)]
24
}
25
26
+const _cleanString = (str) => str.toLowerCase().replace(/[\W_]+/g, ' ').split(' ').filter(s => s && s.length > 0).join(' ')
27
+
28
const wer = async (text1, text2) => {
29
+ const from = _cleanString(text1 || '')
30
+ const to = _cleanString(text2 || '')
31
return {
- distance: speechScorer.calculateEditDistance(text1 || '', text2 || ''),
- wer: speechScorer.wordErrorRate(text1 || '', text2 || '')
32
+ distance: speechScorer.calculateEditDistance(from, to),
33
+ wer: speechScorer.wordErrorRate(from, to)
34
35
36
0 commit comments