app/src/main/java/com/example/jarvis_stts/JarviceService.kt aktualisiert
This commit is contained in:
@@ -143,10 +143,14 @@ class JarvisService : Service(), RecognitionListener {
|
||||
val json = JSONObject(hypothesis)
|
||||
val partialText = json.optString("partial").lowercase().trim()
|
||||
|
||||
// Regex \b bedeutet "Wortgrenze". Er sucht nach dem eigenständigen Wort.
|
||||
// Verhindert Reaktionen auf Fantasiewörter, in denen die Silben vorkommen.
|
||||
if (Regex("\\b(jarvis)\\b").containsMatchIn(partialText)) {
|
||||
Log.d("JARVIS", "WAKE WORD IM TEXT ERKANNT: $partialText")
|
||||
// HIER: Lass dir mal ausgeben, was er eigentlich versteht!
|
||||
if (partialText.isNotEmpty()) {
|
||||
Log.d("JARVIS_DEBUG", "Vosk hört: $partialText")
|
||||
}
|
||||
|
||||
// Unser Regex-Check (den passen wir gleich an)
|
||||
if (Regex("\\b(jarvis|computer)\\b").containsMatchIn(partialText)) {
|
||||
Log.d("JARVIS", "WAKE WORD ERKANNT: $partialText")
|
||||
triggerJarvis()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
||||
Reference in New Issue
Block a user