|
|
|
|
|
|
|
|
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_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_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_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 |
|
|
// #endregion |
|
|
|
|
|
|
|
|
// #region intents |
|
|
// #region intents |
|
|
|
|
|
|
|
|
listSpeechsynth.voice = element; |
|
|
listSpeechsynth.voice = element; |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
speechsynth.rate = 0.88; |
|
|
listSpeechsynth.rate = 0.7; |
|
|
listSpeechsynth.rate = 0.7; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readQuestionThree(); |
|
|
readQuestionThree(); |
|
|
break; |
|
|
break; |
|
|
case 4: |
|
|
case 4: |
|
|
|
|
|
readQuestionFour(); |
|
|
break; |
|
|
break; |
|
|
case 5: |
|
|
case 5: |
|
|
break; |
|
|
break; |
|
|
|
|
|
|
|
|
let utterance = new SpeechSynthesisUtterance(); |
|
|
let utterance = new SpeechSynthesisUtterance(); |
|
|
utterance.voice = voices[2]; |
|
|
utterance.voice = voices[2]; |
|
|
utterance.text = QUESTION_TWO; |
|
|
utterance.text = QUESTION_TWO; |
|
|
|
|
|
utterance.rate = 0.8; |
|
|
window.speechSynthesis.speak(utterance); |
|
|
window.speechSynthesis.speak(utterance); |
|
|
utterance.onend = function (event) { |
|
|
utterance.onend = function (event) { |
|
|
window.setTimeout( |
|
|
window.setTimeout( |
|
|
|
|
|
|
|
|
let utterance = new SpeechSynthesisUtterance(); |
|
|
let utterance = new SpeechSynthesisUtterance(); |
|
|
utterance.voice = voices[2]; |
|
|
utterance.voice = voices[2]; |
|
|
utterance.text = QUESTION_THREE; |
|
|
utterance.text = QUESTION_THREE; |
|
|
|
|
|
utterance.rate = 0.88; |
|
|
window.speechSynthesis.speak(utterance); |
|
|
window.speechSynthesis.speak(utterance); |
|
|
utterance.onend = function (event) { |
|
|
utterance.onend = function (event) { |
|
|
speak(QUESTION_THREE_QUESTIONS_PT1[questionThreeCount]); |
|
|
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) { |
|
|
function handleAnswer (query) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function handleAnswerToThirdQuestion (query) { |
|
|
function handleAnswerToThirdQuestion (query) { |
|
|
speechsynth.rate = 0.87; |
|
|
|
|
|
|
|
|
speechsynth.rate = 0.88; |
|
|
query = query.replace(' ', ''); |
|
|
query = query.replace(' ', ''); |
|
|
|
|
|
|
|
|
let answerArray; |
|
|
let answerArray; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (strike === 2 || questionThreeCount === 5) { |
|
|
if (strike === 2 || questionThreeCount === 5) { |
|
|
speechsynth.rate = 1; |
|
|
|
|
|
|
|
|
speechsynth.rate = 0.88; |
|
|
console.log('question 3 points: ' + questionPoints[question]); |
|
|
console.log('question 3 points: ' + questionPoints[question]); |
|
|
skipRecording = true; |
|
|
skipRecording = true; |
|
|
speak('weiter geht es mit der Nächsten Frage'); |
|
|
speak('weiter geht es mit der Nächsten Frage'); |
|
|
|
|
|
|
|
|
// testBtn.disabled = false |
|
|
// testBtn.disabled = false |
|
|
// testBtn.textContent = 'record...' |
|
|
// testBtn.textContent = 'record...' |
|
|
}; |
|
|
}; |
|
|
1; |
|
|
|
|
|
|
|
|
|
|
|
recognition.onspeechend = function () { |
|
|
recognition.onspeechend = function () { |
|
|
// recognition.stop(); |
|
|
// recognition.stop(); |
|
|
// testBtn.disabled = false; |
|
|
// testBtn.disabled = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function startDemenzScreening () { |
|
|
function startDemenzScreening () { |
|
|
// ws.send('starte demenz test'); |
|
|
// ws.send('starte demenz test'); |
|
|
startQuestion(2); |
|
|
|
|
|
|
|
|
startQuestion(4); |
|
|
testBtn.disabled = true; |
|
|
testBtn.disabled = true; |
|
|
testBtn.textContent = 'Test in progress'; |
|
|
testBtn.textContent = 'Test in progress'; |
|
|
infoPara.textContent = 'wait...'; |
|
|
infoPara.textContent = 'wait...'; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function testSpeechOut () { |
|
|
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.text = 'test 123'; |
|
|
// speechsynth.volume = 1; |
|
|
// speechsynth.volume = 1; |