added part one of last question
This commit is contained in:
parent
b56f6dfa22
commit
05bb11382d
@ -18,6 +18,8 @@ const QUESTION_ONE = 'Ich werde Ihnen jetzt langsam eine Liste mit Worten vorles
|
||||
const QUESTION_ONE_PT2 = 'Vielen Dank. Nun nenne ich Ihnen die gleichen 10 Worte ein zweites mal. Auch danach sollen Sie wieder möglichst viele Worte wiederholen';
|
||||
const QUESTION_TWO = 'Nennen Sie mir bitte so viel Dinge wie möglich, die man im Supermarkt kaufen kann. Sie haben dafür eine Minute Zeit. Und Los';
|
||||
const QUESTION_THREE = 'Ich werde Ihnen jetzt eine Zahlenreihe nennen, die Sie mir dann bitte in umgekehrter Reihenfolge wiederholen sollen. Wenn ich beispielsweise, vier - fünf sage, dann sagen Sie bitte, fünf - vier.';
|
||||
const QUESTION_FOUR = 'Wir kommen nun zur vierten Frage. Bitte zählen Sie von 76 an rückwärts. Nennen Sie die Zahlen abwechselnd als ganze Zahlen und als einzelne Ziffern. Zum Beispiel:';
|
||||
const QUESTION_FOUR_PT2 = ['34', '3, 3', '32', '3, 1'];
|
||||
// #endregion
|
||||
|
||||
// #region intents
|
||||
@ -118,7 +120,7 @@ window.speechSynthesis.onvoiceschanged = function () {
|
||||
listSpeechsynth.voice = element;
|
||||
}
|
||||
});
|
||||
|
||||
speechsynth.rate = 0.88;
|
||||
listSpeechsynth.rate = 0.7;
|
||||
};
|
||||
|
||||
@ -233,6 +235,7 @@ function handleQuestion () {
|
||||
readQuestionThree();
|
||||
break;
|
||||
case 4:
|
||||
readQuestionFour();
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
@ -259,6 +262,7 @@ function readQuestionTwo () {
|
||||
let utterance = new SpeechSynthesisUtterance();
|
||||
utterance.voice = voices[2];
|
||||
utterance.text = QUESTION_TWO;
|
||||
utterance.rate = 0.8;
|
||||
window.speechSynthesis.speak(utterance);
|
||||
utterance.onend = function (event) {
|
||||
window.setTimeout(
|
||||
@ -281,13 +285,24 @@ function readQuestionThree () {
|
||||
let utterance = new SpeechSynthesisUtterance();
|
||||
utterance.voice = voices[2];
|
||||
utterance.text = QUESTION_THREE;
|
||||
utterance.rate = 0.88;
|
||||
window.speechSynthesis.speak(utterance);
|
||||
utterance.onend = function (event) {
|
||||
speak(QUESTION_THREE_QUESTIONS_PT1[questionThreeCount]);
|
||||
};
|
||||
utterance.onerror = function (event) {
|
||||
console.log('An error has occurred with the speech synthesis: ' + event.error);
|
||||
};
|
||||
}
|
||||
|
||||
function readQuestionFour () {
|
||||
// skipRecording = true;
|
||||
// speak(QUESTION_FOUR);
|
||||
for (let i = 0; i < QUESTION_FOUR_PT2.length; i++) {
|
||||
let utterance = new SpeechSynthesisUtterance();
|
||||
utterance.voice = voices[2];
|
||||
utterance.rate = 0.75;
|
||||
utterance.text = QUESTION_FOUR_PT2[i];
|
||||
window.speechSynthesis.speak(utterance);
|
||||
}
|
||||
// speak('Sie haben hierfür 1 Minute Zeit.');
|
||||
}
|
||||
|
||||
function handleAnswer (query) {
|
||||
@ -336,7 +351,7 @@ function handleAnswerToSecondQuestion (answer) {
|
||||
}
|
||||
|
||||
function handleAnswerToThirdQuestion (query) {
|
||||
speechsynth.rate = 0.87;
|
||||
speechsynth.rate = 0.88;
|
||||
query = query.replace(' ', '');
|
||||
|
||||
let answerArray;
|
||||
@ -359,7 +374,7 @@ function handleAnswerToThirdQuestion (query) {
|
||||
}
|
||||
|
||||
if (strike === 2 || questionThreeCount === 5) {
|
||||
speechsynth.rate = 1;
|
||||
speechsynth.rate = 0.88;
|
||||
console.log('question 3 points: ' + questionPoints[question]);
|
||||
skipRecording = true;
|
||||
speak('weiter geht es mit der Nächsten Frage');
|
||||
@ -411,7 +426,7 @@ recognition.onresult = function (event) {
|
||||
// testBtn.disabled = false
|
||||
// testBtn.textContent = 'record...'
|
||||
};
|
||||
1;
|
||||
|
||||
recognition.onspeechend = function () {
|
||||
// recognition.stop();
|
||||
// testBtn.disabled = false;
|
||||
@ -516,7 +531,7 @@ function processSpeech (speechResult) {
|
||||
|
||||
function startDemenzScreening () {
|
||||
// ws.send('starte demenz test');
|
||||
startQuestion(2);
|
||||
startQuestion(4);
|
||||
testBtn.disabled = true;
|
||||
testBtn.textContent = 'Test in progress';
|
||||
infoPara.textContent = 'wait...';
|
||||
@ -524,14 +539,7 @@ function startDemenzScreening () {
|
||||
}
|
||||
|
||||
function testSpeechOut () {
|
||||
answerQuery = 'apfel wiese tisch apfel lampe pferd';
|
||||
question = 1;
|
||||
for (let i = 0; i < 2; i++) {
|
||||
var tokens = answerQuery.split(new RegExp(separators.join('|'), 'g'));
|
||||
questionPoints[question] += calculatePoints(tokens, QUESTION_ONE_ANSWERS);
|
||||
}
|
||||
|
||||
console.log(questionPoints[question]);
|
||||
readQuestionFour();
|
||||
|
||||
// speechsynth.text = 'test 123';
|
||||
// speechsynth.volume = 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user