parse stt on partial results
This commit is contained in:
parent
f6842a3832
commit
a86a57889d
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -29,7 +29,7 @@
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
@ -46,19 +46,14 @@ class SttDialog : DialogFragment() {
|
||||
}
|
||||
|
||||
override fun onPartialResults(data: Bundle) {
|
||||
data.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.let { results ->
|
||||
if (results.isNotEmpty())
|
||||
partialResultsTextView?.text = results[0]
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResults(data: Bundle) {
|
||||
data.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.let { results ->
|
||||
matchActivity?.apply {
|
||||
matchModel?.apply {
|
||||
data.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION)?.let { results ->
|
||||
for (result in results) {
|
||||
partialResultsTextView?.text = result
|
||||
for (player in players) {
|
||||
if (player.pattern?.matcher(result)?.find() == true) {
|
||||
stt?.stopListening()
|
||||
dismiss()
|
||||
updateScore(player)
|
||||
updateUI()
|
||||
@ -66,12 +61,15 @@ class SttDialog : DialogFragment() {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResults(data: Bundle) {
|
||||
partialResultsTextView?.text = getString(R.string.not_understood)
|
||||
onError(ERROR_NOT_UNDERSTOOD)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onEndOfSpeech() {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user