Package edu.tufts.hrilab.asr.sphinx4
Class Sphinx4Component
java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
edu.tufts.hrilab.asr.sphinx4.Sphinx4Component
- All Implemented Interfaces:
ASRInterface,Sphinx4Interface
The implementation of an DIARCComponent with the Sphinx4 speech recognizer.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class edu.tufts.hrilab.diarc.DiarcComponent
executionLoopCycleTime, log, shouldRunExecutionLoop -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAccept last recognition result and pass to parser.protected List<org.apache.commons.cli.Option>Provides command line argument descriptions.voidClear recognition queue.voidvoidget current control state, one of {CONFIRM, ACCEPT, REJECT}.Get the next recognition result from the recognition queue while in CONFIRM control state.protected voidinit()Perform any component initialization.protected voidparseArgs(org.apache.commons.cli.CommandLine cmdLine) Parses command line arguments specific to this DIARCComponent.voidReject last recognition result.voidvoidSet control state to one of {CONFIRM, ACCEPT, REJECT}.voidsetDictionary(String path) Given the path to a new dictionary it concats it to the default dictionary in a new temp filevoidsetGrammar(String path) voidtranscribeAndReportSpeech(float[] samples) Takes in an array of data and reports it to the rest of the language pipelinetranscribeSpeech(float[] samples) Takes in an array of data and gives the transcribed string.Methods inherited from class edu.tufts.hrilab.diarc.DiarcComponent
attachShutdownHook, createInstance, createInstance, createInstance, executionLoop, getMyGroupConstraints, getMyGroups, getMyService, getMyServices, main, postRegistrationInit, shutdown, shutdownComponent
-
Constructor Details
-
Sphinx4Component
public Sphinx4Component()Constructor.- See Also:
-
-
Method Details
-
init
protected void init()Description copied from class:DiarcComponentPerform any component initialization. This should not be used for setting local fields to default values as was the case in DIARC. This method is called after the constructor, and after parseArgs. Setting default values should be done in field declaration or in the constructor.- Overrides:
initin classDiarcComponent
-
setConfig
- Specified by:
setConfigin interfaceSphinx4Interface
-
setGrammar
- Specified by:
setGrammarin interfaceSphinx4Interface
-
setDictionary
Given the path to a new dictionary it concats it to the default dictionary in a new temp file- Parameters:
path- The relative path of the new dictionary with new phonetic pronunciations- Throws:
IOException- If an I/O error occurs
-
parseArgs
protected void parseArgs(org.apache.commons.cli.CommandLine cmdLine) Parses command line arguments specific to this DIARCComponent.- Overrides:
parseArgsin classDiarcComponent- Parameters:
cmdLine- The custom command line argumentsfalseotherwise
-
additionalUsageInfo
Provides command line argument descriptions.- Overrides:
additionalUsageInfoin classDiarcComponent- Returns:
- Command line argument switches and descriptions
-
setControlState
Description copied from interface:Sphinx4InterfaceSet control state to one of {CONFIRM, ACCEPT, REJECT}. GUI only method.- Specified by:
setControlStatein interfaceSphinx4Interface- Parameters:
state- one of {"CONFIRM", "ACCEPT", "REJECT"}
-
getControlState
Description copied from interface:Sphinx4Interfaceget current control state, one of {CONFIRM, ACCEPT, REJECT}. GUI only method.- Specified by:
getControlStatein interfaceSphinx4Interface
-
acceptUtterance
public void acceptUtterance()Description copied from interface:Sphinx4InterfaceAccept last recognition result and pass to parser. This is only for the CONFIRM control state.- Specified by:
acceptUtterancein interfaceSphinx4Interface
-
rejectUtterance
public void rejectUtterance()Description copied from interface:Sphinx4InterfaceReject last recognition result. This is only for the CONFIRM control state.- Specified by:
rejectUtterancein interfaceSphinx4Interface
-
getOnDeckText
Description copied from interface:Sphinx4InterfaceGet the next recognition result from the recognition queue while in CONFIRM control state.- Specified by:
getOnDeckTextin interfaceSphinx4Interface
-
clearRecogntionHistory
public void clearRecogntionHistory()Description copied from interface:Sphinx4InterfaceClear recognition queue. Only for use while in CONFIRM control state.- Specified by:
clearRecogntionHistoryin interfaceSphinx4Interface
-
transcribeSpeech
Takes in an array of data and gives the transcribed string.- Specified by:
transcribeSpeechin interfaceASRInterface- Parameters:
samples- Array of values representing the incoming sound- Returns:
- The string of the transcribed speech
-
transcribeAndReportSpeech
public void transcribeAndReportSpeech(float[] samples) Takes in an array of data and reports it to the rest of the language pipeline- Specified by:
transcribeAndReportSpeechin interfaceASRInterface- Parameters:
samples- Array of values representing the incoming sound
-
disableMicrophone
public void disableMicrophone()- Specified by:
disableMicrophonein interfaceASRInterface
-
enableMicrophone
public void enableMicrophone()- Specified by:
enableMicrophonein interfaceASRInterface
-