|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.rmi.server.RemoteObject | +--java.rmi.server.RemoteServer | +--java.rmi.server.UnicastRemoteObject | +--metaglue.AgentAgent | +--agentland.util.GoodAgent | +--agentland.resource.ManagedAgent | +--speech.GrammarCenterAgent
This is the center where it listens to the user and farms out stuff to various AppGrammars.
ManagedAgent
,
GrammarCenter
,
TagsListener
, Serialized FormInner classes inherited from class metaglue.AgentAgent |
AgentAgent.Attribute |
Field Summary | |
boolean |
divertToTypeWriter
|
TypeWriter |
tw
|
Fields inherited from class agentland.resource.ManagedAgent |
rm, society |
Fields inherited from class agentland.util.GoodAgent |
alert, notifier |
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Fields inherited from interface metaglue.Agent |
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING |
Constructor Summary | |
GrammarCenterAgent()
Our lovely constructor. |
Method Summary | |
void |
activate(String grammarName)
Activate a grammar, so that any public rule in the grammar can be spoken. |
void |
activate(String grammarName,
String ruleName)
Activate a specific rule in a grammar so that it can be spoken |
void |
addAlternative(String grammarName,
String ruleName,
String spokenText)
This adds an alternative to some rule. |
void |
addAlternativeRule(String grammarName,
String ruleName,
String ruleNameToAdd)
Add an alternative rule to the given rule. |
void |
addAlternatives(String grammarName,
String ruleName,
Collection spokenText)
This does the same as the single case, but for a vector of alternatives. |
void |
addDictationListener()
Registers a listener for dictation events. |
void |
addNewRuleAlternatives(String grammarName,
String ruleName)
Adds a new rule to the given grammar as a RuleAlternative. |
void |
deactivate(String grammarName)
Deactivate all the rules in a grammar |
void |
deactivate(String grammarName,
String ruleName)
Deactivate a specific rule in a grammar. |
protected boolean |
ensureStartupNeeds()
This a separeate so that we can override it. |
Vector |
getActiveGrammars()
Gets all the active grammars. |
Vector |
getActiveRules(String sGrammarName)
Gets all the rules in a grammar that are set active. |
String |
getDictation()
Sets the speech system to dictation mode, where it listens for a single sentence of speech from the user. |
String |
getFile(String grammarName)
Gets the String name of the file of this grammar. |
String |
getGrammar(String sGrammarName,
AgentID whocares)
Gets the grammar specified in sGrammarName, and returns the String name of the grammar. |
Vector |
getPublicRules(String sGrammarName)
Gets all the rules in the grammar that are marked public. |
String |
getRandomSentence(String sGrammarName)
Randomly picks a public rule from a given grammar, and randomly generates a sentence based on that rule. |
String |
getRandomSentence(String sGrammarName,
boolean bPublicRulesOnly)
If bPublicRulesOnly is true, randomly picks a public rule from a given grammar, and randomly generates a sentence based on that rule. |
String |
getRandomSentence(String sGrammarName,
String sRuleName)
Gets a random sentence based on a rule in a given grammar. |
boolean |
hasRule(String grammarName,
String ruleName)
Determines whether the given grammar has the given rule. |
boolean |
isEnabled(String grammarName)
Gets whether or not this grammar is enabled. |
Enumeration |
listRuleNames(String grammarName)
Lists the names of the rules of a given grammar. |
void |
nap(int ms)
Take a short nap--to let the dictation voice play. |
void |
pauseRecognizer()
Pause ViaVoice's recognizer. |
void |
playWav(String wavFile,
boolean sync)
Speech out playing files. |
void |
printRules(String grammarName)
Prints out the rules in a specified grammar to standard output |
String |
processString(String text)
Tries to match a String text with one of Listen's RuleGrammars. |
void |
releaseGrammar(String gname,
AgentID whocares)
Let an owner of a grammar release it. |
void |
requestWakeUp()
Requests that the speech system start listening for public rules. |
void |
requestWakeUp(boolean playattention)
Requests that the speech system start listening for public rules. |
void |
resultAccepted(String who,
Hashtable tags)
This is what is called by my application grammar. |
void |
resumeRecognizer()
Resumes ViaVoice's recognizer. |
void |
save(String grammarName)
Calls the save method on the underlying ApplicationGrammar |
void |
say(String text,
boolean sync)
Speak the given sentence using a speech synthesizer. |
String |
sayRandomSentence(String sGrammarName)
Picks a random public rule from a given grammar, and says a random sentence from that rule. |
void |
setAlternatives(String grammarName,
String ruleName,
Collection spokenText)
Sets the alternatives of a given rule. |
void |
setDictionFromTypeWriter(boolean b)
|
void |
setTypeWriter(String agentID)
|
boolean |
sleeping()
|
void |
stateChanged(int iState)
Called when the speech system wakes up or goes to sleep. |
void |
tellHeard(String s)
Sends a message through the notifier about what was spoken. |
void |
volumeOverThresh(float fVolume,
float fThresh)
Not used right now. |
void |
volumeUnderThresh(float fVolume,
float fThresh)
Not used right now. |
Methods inherited from class agentland.resource.ManagedAgent |
connect, getAlert, getNeed, isAvailable, isAvailable, reliesOn, reliesOn, replace, replace, request, request, request, requestAgent, requestAgent, resources, resourcesByAgentID, setNeed, tiedTo, yank, yank, yank |
Methods inherited from class agentland.util.GoodAgent |
addSpy, addSpy, alert, alertString, beep, error, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell |
Methods inherited from class metaglue.AgentAgent |
addMonitor, alive, buildEHAFor, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getOldLogs, getProperties, getProxyHandlerClass, getSociety, installAPH, log, log, lookupClass, reliesOn, reliesOnSynch, removeAPHFromCatalog, removeFrozen, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, toString, whereAreYou |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals, getRef, hashCode, toStub |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface agentland.resource.Managed |
getNeed, replace, replace, resources, yank, yank |
Methods inherited from interface agentland.util.Good |
getHistory, getHistoryElement, resetHistory |
Methods inherited from interface metaglue.Agent |
addMonitor, alive, getAgentID, getMetaglueAgentID, getOldLogs, shutdown, startup, whereAreYou |
Methods inherited from interface agentland.util.Spy |
tell |
Field Detail |
public TypeWriter tw
public boolean divertToTypeWriter
Constructor Detail |
public GrammarCenterAgent() throws RemoteException
Method Detail |
protected boolean ensureStartupNeeds()
boolean
value which is true if all needs
were satisfied, false otherwisepublic void nap(int ms)
public String getDictation()
getDictation
in interface GrammarCenter
String
valuepublic void playWav(String wavFile, boolean sync)
playWav
in interface GrammarCenter
wavFile
- a String
valuesync
- block until call completed.public void say(String text, boolean sync)
say
in interface GrammarCenter
text
- a String
valuesync
- a boolean
valuepublic void pauseRecognizer()
pauseRecognizer
in interface GrammarCenter
public void resumeRecognizer()
resumeRecognizer
in interface GrammarCenter
public void requestWakeUp()
requestWakeUp
in interface GrammarCenter
public void requestWakeUp(boolean playattention)
requestWakeUp
in interface GrammarCenter
playattention
- a boolean
valuepublic String processString(String text)
processString
in interface GrammarCenter
text
- a String
valueString
valuepublic void setDictionFromTypeWriter(boolean b)
setDictionFromTypeWriter
in interface GrammarCenter
public void setTypeWriter(String agentID)
setTypeWriter
in interface GrammarCenter
public String getGrammar(String sGrammarName, AgentID whocares)
getGrammar
in interface GrammarCenter
sGrammarName
- a String
valuewhocares
- an AgentID
valueString
valuepublic void releaseGrammar(String gname, AgentID whocares)
releaseGrammar
in interface GrammarCenter
gname
- a String
valuewhocares
- an AgentID
valuepublic void tellHeard(String s)
s
- a String
valuepublic void resultAccepted(String who, Hashtable tags)
resultAccepted
in interface TagsListener
who
- a String
valuetags
- a Hashtable
valuepublic Enumeration listRuleNames(String grammarName)
listRuleNames
in interface GrammarCenter
grammarName
- a String
valueEnumeration
valuepublic void addAlternative(String grammarName, String ruleName, String spokenText)
addAlternative
in interface GrammarCenter
grammarName
- a String
valueruleName
- a String
valuespokenText
- a String
valuepublic void addAlternatives(String grammarName, String ruleName, Collection spokenText)
addAlternatives
in interface GrammarCenter
grammarName
- a String
valueruleName
- a String
valuespokenText
- a Collection
valueaddAlternative(String,String,String)
public void save(String grammarName)
save
in interface GrammarCenter
grammarName
- a String
valueApplicationGrammar
public void activate(String grammarName)
activate
in interface GrammarCenter
grammarName
- a String
valuepublic void activate(String grammarName, String ruleName)
activate
in interface GrammarCenter
grammarName
- a String
valueruleName
- a String
valuepublic void deactivate(String grammarName)
deactivate
in interface GrammarCenter
grammarName
- a String
valuepublic void deactivate(String grammarName, String ruleName)
deactivate
in interface GrammarCenter
grammarName
- a String
valueruleName
- a String
valuepublic Vector getPublicRules(String sGrammarName)
getPublicRules
in interface GrammarCenter
sGrammarName
- a String
valueVector
valuepublic Vector getActiveGrammars()
getActiveGrammars
in interface GrammarCenter
Vector
valuepublic Vector getActiveRules(String sGrammarName)
getActiveRules
in interface GrammarCenter
sGrammarName
- a String
valueVector
valuepublic String getFile(String grammarName)
getFile
in interface GrammarCenter
grammarName
- a String
valueString
valuepublic boolean isEnabled(String grammarName)
isEnabled
in interface GrammarCenter
grammarName
- a String
valueboolean
valuepublic void addAlternativeRule(String grammarName, String ruleName, String ruleNameToAdd)
addAlternativeRule
in interface GrammarCenter
grammarName
- a String
valueruleName
- a String
valueruleNameToAdd
- a String
valuepublic void setAlternatives(String grammarName, String ruleName, Collection spokenText)
setAlternatives
in interface GrammarCenter
grammarName
- a String
valueruleName
- a String
valuespokenText
- a Collection
valuepublic void addNewRuleAlternatives(String grammarName, String ruleName)
addNewRuleAlternatives
in interface GrammarCenter
grammarName
- a String
valueruleName
- a String
valuepublic boolean hasRule(String grammarName, String ruleName)
hasRule
in interface GrammarCenter
grammarName
- a String
valueruleName
- a String
valueboolean
valuepublic void printRules(String grammarName)
printRules
in interface GrammarCenter
grammarName
- the name of the grammarpublic void addDictationListener()
addDictationListener
in interface GrammarCenter
speech.GrammarCenter
RemoteException
- if an error occurspublic String getRandomSentence(String sGrammarName, String sRuleName)
getRandomSentence
in interface GrammarCenter
sGrammarName
- a String
valuesRuleName
- a String
valueString
valuepublic String sayRandomSentence(String sGrammarName)
sayRandomSentence
in interface GrammarCenter
sGrammarName
- a String
valueString
valuegetRandomSentence(String)
public String getRandomSentence(String sGrammarName)
getRandomSentence
in interface GrammarCenter
sGrammarName
- a String
valueString
valuegetRandomSentence(String,boolean)
public String getRandomSentence(String sGrammarName, boolean bPublicRulesOnly)
getRandomSentence
in interface GrammarCenter
sGrammarName
- a String
valuebPublicRulesOnly
- a boolean
valueString
valuepublic boolean sleeping()
sleeping
in interface GrammarCenter
public void stateChanged(int iState)
SpeechStateListener
stateChanged
in interface SpeechStateListener
speech.tools.SpeechStateListener
iState
- an int
valuepublic void volumeOverThresh(float fVolume, float fThresh)
SpeechStateListener
volumeOverThresh
in interface SpeechStateListener
public void volumeUnderThresh(float fVolume, float fThresh)
SpeechStateListener
volumeUnderThresh
in interface SpeechStateListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |