speech
Class Listen

java.lang.Object
  |
  +--speech.Listen

public class Listen
extends Object

The startup interaction between viaVoice's speech recognition and synthesis is buggy. Don't change things involving these below in the class's constructor.


Method Summary
 void activate(javax.speech.recognition.RuleGrammar g)
          These are the methods for activating and deactivating individual grammars and their rules.
 void activate(javax.speech.recognition.RuleGrammar g, String ruleName)
           
 javax.speech.recognition.RuleGrammar addGrammar(String filename)
          Try to avoid using this filename mechanism to load grammars because gramars loaded this way don't really support the JSGF import mechanism.
 javax.speech.recognition.RuleGrammar addGrammar(URL base, String grammarName)
          Load up and add a grammar to the pool of grammars.
 void commitChanges()
          When done mucking about, commit changes.
 void deactivate(javax.speech.recognition.RuleGrammar g)
           
 void deactivate(javax.speech.recognition.RuleGrammar g, String ruleName)
           
 Vector getActiveRules(javax.speech.recognition.RuleGrammar ruleG)
           
 String getDictation()
          Get a dictation string out of us.
static Listen getListen()
          Call this to get the single static object that everything shares.
static Listen getListen(TalkNSing talker)
          Call this to get the single static object that everything shares.
 Vector getPublicRules(javax.speech.recognition.RuleGrammar ruleG)
           
static boolean isListen()
          True if Listen has been initialized.
 javax.speech.recognition.RuleGrammar loadJSGF(URL base, String grammarName)
           
static void main(String[] args)
           
 void pauseRecognizer()
           
 String processString(String text)
          Process a text string against all active grammars
 void requestGoToSleep()
          This is the public version of goToSleep.
 void requestWakeUp()
           
 void requestWakeUp(boolean playattention)
          Public wakeUp method to programatically wake up the system.
 void resumeRecognizer()
           
 void setTalker(Say talker)
           
 void setTalker(TalkNSing talker)
          Set what plays our noises and says our sayings.,
static Listen setupLinked()
          Make listen use local speech out resources to talk back.
 boolean sleeping()
          Are we in our sleeping state?
 void startChanges()
          When starting a series of changes, call this to make sure recognizer is suspended.
 void stayAwake()
          Make sure the system doesn't go to sleep until further notice.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isListen

public static boolean isListen()
True if Listen has been initialized.

getListen

public static Listen getListen(TalkNSing talker)
Call this to get the single static object that everything shares.

getListen

public static Listen getListen()
Call this to get the single static object that everything shares.

setupLinked

public static Listen setupLinked()
Make listen use local speech out resources to talk back.

setTalker

public void setTalker(Say talker)

setTalker

public void setTalker(TalkNSing talker)
Set what plays our noises and says our sayings.,

pauseRecognizer

public void pauseRecognizer()

resumeRecognizer

public void resumeRecognizer()

getPublicRules

public Vector getPublicRules(javax.speech.recognition.RuleGrammar ruleG)

getActiveRules

public Vector getActiveRules(javax.speech.recognition.RuleGrammar ruleG)

requestGoToSleep

public void requestGoToSleep()
This is the public version of goToSleep. If the user has told the system to stay awake, then this is ignored.

requestWakeUp

public void requestWakeUp(boolean playattention)
Public wakeUp method to programatically wake up the system.

requestWakeUp

public void requestWakeUp()

stayAwake

public void stayAwake()
Make sure the system doesn't go to sleep until further notice.

sleeping

public boolean sleeping()
Are we in our sleeping state?

activate

public void activate(javax.speech.recognition.RuleGrammar g)
These are the methods for activating and deactivating individual grammars and their rules. I put all of the functionality here rather than in ApplicationGrammar, but perhaps it belongs there instead. Active grammars are ones the room is listening for when it is awake. (E.g., the user has just said, "Computer.") If the room is awake, they are immediately activated. Otherwise, they will become available the next time the room wakes up.

activate

public void activate(javax.speech.recognition.RuleGrammar g,
                     String ruleName)

deactivate

public void deactivate(javax.speech.recognition.RuleGrammar g)

deactivate

public void deactivate(javax.speech.recognition.RuleGrammar g,
                       String ruleName)

addGrammar

public javax.speech.recognition.RuleGrammar addGrammar(URL base,
                                                       String grammarName)
Load up and add a grammar to the pool of grammars.
Returns:
the loaded grammar

loadJSGF

public javax.speech.recognition.RuleGrammar loadJSGF(URL base,
                                                     String grammarName)
                                              throws IOException,
                                                     javax.speech.recognition.GrammarException,
                                                     MalformedURLException

addGrammar

public javax.speech.recognition.RuleGrammar addGrammar(String filename)
Try to avoid using this filename mechanism to load grammars because gramars loaded this way don't really support the JSGF import mechanism.

processString

public String processString(String text)
Process a text string against all active grammars

startChanges

public void startChanges()
When starting a series of changes, call this to make sure recognizer is suspended.

commitChanges

public void commitChanges()
When done mucking about, commit changes.

getDictation

public String getDictation()
Get a dictation string out of us.

main

public static void main(String[] args)