inpro.sphinx.decoder
Class FakeSearch

java.lang.Object
  extended by inpro.sphinx.decoder.NoSearch
      extended by inpro.sphinx.decoder.FakeSearch
All Implemented Interfaces:
edu.cmu.sphinx.decoder.search.SearchManager, edu.cmu.sphinx.util.props.Configurable

public class FakeSearch
extends NoSearch

recognizing is so time consuming why not have a recognizer that doesn't recognize at all, but fakes results from a given transcription, just consumes frames from the frontend and calls event listeners and monitors as needed

Author:
timo

Nested Class Summary
private  class FakeSearch.TokenList
           
 
Field Summary
private  edu.cmu.sphinx.linguist.dictionary.Dictionary dictionary
           
private  int frameNumber
           
private static org.apache.log4j.Logger logger
           
static java.lang.String PROP_DICTIONARY
           
static java.lang.String PROP_TRANSCRIPT_FILE
           
static java.lang.String PROP_UNIT_MANAGER
           
static java.lang.String PROP_UNIT_TIER
           
static java.lang.String PROP_WORD_TIER
           
private  FakeSearch.TokenList sortedTokenList
           
private  java.lang.String transcriptName
           
private  edu.cmu.sphinx.linguist.acoustic.UnitManager unitManager
           
private  java.lang.String unitTierName
           
private  java.lang.String wordTierName
           
 
Fields inherited from class inpro.sphinx.decoder.NoSearch
emptyResult, fe, PROP_FRONTEND
 
Constructor Summary
FakeSearch()
           
 
Method Summary
 void allocate()
           
 void loadTranscript(java.lang.String filename)
           
 void loadTranscript(TextGrid tg)
          create the internal sortedTokenList from the given Textgrid this works as follows: - iterate over the words in the word tier - find pronunciation from the dictionary - generate a PronunciationState and Token for this word and add it to the sortedTokenList - for each unit in the pronunciation - assert that the given unit labels match the units in the pronunciation - generate a UnitState and Token for this unit and add it to the sortedTokenList
 void newProperties(edu.cmu.sphinx.util.props.PropertySheet ps)
           
 edu.cmu.sphinx.result.Result recognize(int nFrames)
          consume the given number of frames from the frontend, find the Token for the result (completely ignoring the data...)
 void setTranscript(java.lang.String filename)
           
 
Methods inherited from class inpro.sphinx.decoder.NoSearch
deallocate, startRecognition, stopRecognition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.apache.log4j.Logger logger

PROP_DICTIONARY

@S4Component(type=edu.cmu.sphinx.linguist.dictionary.Dictionary.class)
public static final java.lang.String PROP_DICTIONARY
See Also:
Constant Field Values

PROP_UNIT_MANAGER

@S4Component(type=edu.cmu.sphinx.linguist.acoustic.UnitManager.class)
public static final java.lang.String PROP_UNIT_MANAGER
See Also:
Constant Field Values

PROP_TRANSCRIPT_FILE

@S4String(defaultValue="")
public static final java.lang.String PROP_TRANSCRIPT_FILE
See Also:
Constant Field Values

PROP_WORD_TIER

@S4String(defaultValue="MAUS-words")
public static final java.lang.String PROP_WORD_TIER
See Also:
Constant Field Values

PROP_UNIT_TIER

@S4String(defaultValue="MAUS-phones")
public static final java.lang.String PROP_UNIT_TIER
See Also:
Constant Field Values

dictionary

private edu.cmu.sphinx.linguist.dictionary.Dictionary dictionary

wordTierName

private java.lang.String wordTierName

unitTierName

private java.lang.String unitTierName

transcriptName

private java.lang.String transcriptName

sortedTokenList

private FakeSearch.TokenList sortedTokenList

frameNumber

private int frameNumber

unitManager

private edu.cmu.sphinx.linguist.acoustic.UnitManager unitManager
Constructor Detail

FakeSearch

public FakeSearch()
Method Detail

allocate

public void allocate()
Specified by:
allocate in interface edu.cmu.sphinx.decoder.search.SearchManager
Overrides:
allocate in class NoSearch

recognize

public edu.cmu.sphinx.result.Result recognize(int nFrames)
consume the given number of frames from the frontend, find the Token for the result (completely ignoring the data...)

Specified by:
recognize in interface edu.cmu.sphinx.decoder.search.SearchManager
Overrides:
recognize in class NoSearch
Parameters:
nFrames - the number of frames to recognize
Returns:
a result that contains information from the transcription up to the current time

loadTranscript

public void loadTranscript(TextGrid tg)
create the internal sortedTokenList from the given Textgrid this works as follows: - iterate over the words in the word tier - find pronunciation from the dictionary - generate a PronunciationState and Token for this word and add it to the sortedTokenList - for each unit in the pronunciation - assert that the given unit labels match the units in the pronunciation - generate a UnitState and Token for this unit and add it to the sortedTokenList

Parameters:
tg - given TextGrid

loadTranscript

public void loadTranscript(java.lang.String filename)

setTranscript

public void setTranscript(java.lang.String filename)

newProperties

public void newProperties(edu.cmu.sphinx.util.props.PropertySheet ps)
                   throws edu.cmu.sphinx.util.props.PropertyException
Specified by:
newProperties in interface edu.cmu.sphinx.util.props.Configurable
Overrides:
newProperties in class NoSearch
Throws:
edu.cmu.sphinx.util.props.PropertyException