Coder Social home page Coder Social logo

[Bug]: ErrorType (UnexpectedBreak,MissingBreak) are not receiving in detailResult words from sdk about cognitive-services-speech-sdk-js HOT 4 CLOSED

syama-aot avatar syama-aot commented on June 12, 2024
[Bug]: ErrorType (UnexpectedBreak,MissingBreak) are not receiving in detailResult words from sdk

from cognitive-services-speech-sdk-js.

Comments (4)

glharper avatar glharper commented on June 12, 2024

@syama-aot Thanks for using JS Speech SDK, and submitting this issue. After creating a PronunciationAssessmentConfig instance, you must set that instance's enableProsodyAssessment property to true, e.g.

        pronunciationAssessmentConfig.enableProsodyAssessment = true;

Hope that helps.

from cognitive-services-speech-sdk-js.

syama-aot avatar syama-aot commented on June 12, 2024

@syama-aot Thanks for using JS Speech SDK, and submitting this issue. After creating a PronunciationAssessmentConfig instance, you must set that instance's enableProsodyAssessment property to true, e.g.

        pronunciationAssessmentConfig.enableProsodyAssessment = true;

Hope that helps.
@glharper ,
Thank you for reply. const pronunciationAssessmentConfig =
sdk.PronunciationAssessmentConfig.fromJSON(
'{ "GradingSystem": "FivePoint",
"Granularity": "Word",
"EnableMiscue": "False"}'
);
pronunciationAssessmentConfig.enableProsodyAssessment = true;

pronunciationAssessmentConfig.enableContentAssessmentWithTopic(
"Talk about your day today"
);

// setting the recognition language to English.
speechConfig.speechRecognitionLanguage = "en-US";
let startTime = 0; // Initialize start time

// create the speech recognizer.
var reco = new sdk.SpeechRecognizer(speechConfig, audioConfig);
pronunciationAssessmentConfig.applyTo(reco);

let totalResultText = ""; // Accumulate recognized text
let pronunciationScores = []; // Store pronunciation assessment scores
let recognitionComplete = false; // Flag to track recognition completion
let contentAssessmentResult = null;
function onRecognizedResult(result) {
if (!recognitionComplete) {
totalResultText += result.text; // Append recognized text
const pronunciationResult =
sdk.PronunciationAssessmentResult.fromResult(result);
// console.log("pronounce result", pronunciationResult);
// console.log("actual result", pronunciationResult);
pronunciationScores.push({
text: result.text,
accuracyScore: pronunciationResult.accuracyScore,
pronunciationScore: pronunciationResult.pronunciationScore,
completenessScore: pronunciationResult.completenessScore,
fluencyScore: pronunciationResult.fluencyScore,
prosodyScore: pronunciationResult.prosodyScore,
result: pronunciationResult.contentAssessmentResult,
});
// contentAssessmentResult =
// pronunciationScores?.[pronunciationScores?.length - 1];

_.forEach(pronunciationResult.detailResult.Words, (word, idx) => {
  console.log(
    "    ",
    idx + 1,
    ": word: ",
    word.Word,
    "\taccuracy score: ",
    word.PronunciationAssessment.AccuracyScore,
    "\terror type: ",
    word.PronunciationAssessment.**ErrorType**,
    ";"
  );
});

}
}

reco.recognizing = (s, e) => {
// console.log(Recognizing: ${e.result.text});
onRecognizedResult(e.result);
};

reco.recognized = (s, e) => {
if (e.result.reason === sdk.ResultReason.RecognizedSpeech) {
console.log(Recognized: ${e.result.text});
onRecognizedResult(e.result);
} else if (e.result.reason === sdk.ResultReason.NoMatch) {
console.log("No speech could be recognized.");
}
};

reco.sessionStopped = (s, e) => {
console.log("Session stopped event received.");
recognitionComplete = true; // Set recognition completion flag
// console.log("Total recognized text:", totalResultText);
// console.log("Pronunciation assessment scores:", pronunciationScores);
// console.log("Content assessment Result", contentAssessmentResult);

const endTime = Date.now(); // Measure end time
const totalTimeSpent = endTime - startTime; // Calculate total time spent
console.log("Total time spent (ms):", totalTimeSpent);
};

reco.startContinuousRecognitionAsync(
() => {
console.log("Continuous recognition started.");
startTime = Date.now(); // Set start time when recognition starts
},
(err) => {
console.error("Error starting continuous recognition:", err);
}
);
This is the code I have. Still I am receiving only Mispronunciations. ( Missing Break, Unexpected Break still missing in API)

from cognitive-services-speech-sdk-js.

glharper avatar glharper commented on June 12, 2024

@syama-aot In the Speech Studio, looking at the sample code (under Developer Resources) for JavaScript, I see this comment:

        // For continuous pronunciation assessment mode, the service won't return the words with `Insertion` or `Omission`
        // We need to compare with the reference text after received all recognized words to get these error words.

The sample code then details logic to perform that comparison. Is that logic what you're asking for?

from cognitive-services-speech-sdk-js.

LeoLiu-Xingchi avatar LeoLiu-Xingchi commented on June 12, 2024

@glharper I have a similar question with the SDK in Swift.
I did enable:

pronAssessmentConfig.enableProsodyAssessment()

But the word-level assessment results never return UnexpectedBreak/MissingBreak. The only errorType I can get is "Mispronunciation".

Here is my setup:

let speechRecognizer = try! SPXSpeechRecognizer(speechConfiguration: speechConfig, language: "en-US", audioConfiguration: audioConfig)

let pronAssessmentConfig = try! SPXPronunciationAssessmentConfiguration("", gradingSystem: SPXPronunciationAssessmentGradingSystem.hundredMark, granularity: SPXPronunciationAssessmentGranularity.phoneme, enableMiscue: false)
                
pronAssessmentConfig.enableProsodyAssessment()
try! pronAssessmentConfig.apply(to: speechRecognizer)

from cognitive-services-speech-sdk-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.