fix bug in prev commit

This commit is contained in:
Dave Horton
2023-11-30 10:41:39 -05:00
parent 6043921067
commit 11283edf6f

View File

@@ -370,7 +370,7 @@ const normalizeAws = (evt, channel, language) => {
const copy = JSON.parse(JSON.stringify(evt));
const alternatives = evt.Transcript?.Results[0]?.Alternatives.map((alt) => {
const items = alt.Items.filter((item) => item.Type === 'pronunciation' && 'Confidence' in item);
const confidence = items.reduce((acc, item) => acc + item.Confidence, 0) / alt.Items.length;
const confidence = items.reduce((acc, item) => acc + item.Confidence, 0) / items.length;
return {
transcript: alt.Transcript,
confidence