Skip to content
Browse files

add OnAnyUtterance listener. Useful for when you just want the user t…

…o say something to continue
  • Loading branch information...
1 parent 467ed71 commit 9028353c892bcf3d6f41dda38ba22bf52555223b @gmilette gmilette committed Mar 21, 2013
Showing with 36 additions and 0 deletions.
  1. +36 −0 library/src/root/gast/speech/voiceaction/MatchAnythingCommand.java
View
36 library/src/root/gast/speech/voiceaction/MatchAnythingCommand.java
@@ -0,0 +1,36 @@
+package root.gast.speech.voiceaction;
+
+import root.gast.speech.text.WordList;
+import root.gast.speech.text.match.WordMatcher;
+
+public class MatchAnythingCommand implements VoiceActionCommand
+{
+ private static final String TAG = "MatchAnythingCommand";
+
+ private OnUnderstoodListener onUnderstood;
+
+ public MatchAnythingCommand(OnUnderstoodListener onUnderstood)
+ {
+ this.onUnderstood = onUnderstood;
+ }
+
+ @Override
+ public boolean interpret(WordList heard, float[] confidence)
+ {
+ boolean understood = false;
+ if (heard.getWords().length > 0)
+ {
+ understood = true;
+ if (onUnderstood != null)
+ {
+ onUnderstood.understood();
+ }
+ }
+ return understood;
+ }
+
+ public OnUnderstoodListener getOnUnderstood()
+ {
+ return onUnderstood;
+ }
+}

0 comments on commit 9028353

Please sign in to comment.
Something went wrong with that request. Please try again.