Skript Context-Dependent System Test
fs setAccess @/home/islpra0/IslData/featAccess
[CodebookSet cbs fs] read ../step8/codebookSet
[DistribSet dss cbs] read ../step10/distribSet
[PhonesSet ps] read ../step2/phonesSet
[Tags tags] read ../step2/tags
Tree dst ps:PHONES ps tags dss
dst.ptreeSet read ../step10/ptreeSet
dst read ../step10/distribTree
SenoneSet sns [DistribStream str dss dst] -phones ps:PHONES -tags tags
[TmSet tms] read ../step2/transitionModels
[TopoSet tps sns tms] read ../step2/topologies
[Tree tpt ps:PHONES ps tags tps] read ../step2/topologyTree
[Dictionary diction ps:PHONES tags] read ../step4/convertedDict
fs FMatrix LDAMatrix
fs:LDAMatrix.data bload ../step5/ldaMatrix
[DBase db] open ../step1/db.dat ../step1/db.idx -mode r
AModelSet amo tpt ROOT
cbs load ../step11/codebookWeights.2
dss load ../step11/distribWeights.2
tpt configure -padPhone @
dst configure -padPhone @
sns setscoreFct base
PHMMSet phmms tpt [tpt.item(0) configure -name]
LCMSet lcms phmms
RCMSet rcms phmms
SVocab voc diction
[LingKS lm NGramLM] load ../step7/langmod
SVMap svmap voc lm
voc read ../step1/vocab
svmap map base
voc:\$ configure -fTag 1
voc:SIL configure -fTag 1
svmap configure -unkString +UNINTELLIGIBLE+
svmap configure -lz 16 -wordPen -0 -filPen 0
STree stree svmap lcms rcms
LTree ltree stree
SPass spass stree ltree
spass configure -morphBeam 30 -stateBeam 50 -wordBeam 35
        
        proc recogRate { corr hypo } {
        
        # filter hypo
          regsub -all {\\(} \$hypo "" hypo
          regsub -all {\\)} \$hypo "" hypo
          regsub -all " SIL " \$hypo " " hypo
          regsub -all {\\+[^ ]*} \$hypo "" hypo
          regsub -all {(\\\$|\\{|\\})} \$hypo "" hypo
          regsub -all " [ ]+" \$hypo " " hypo  
          set hypo [string trim \$hypo]
        
        
          # filter ref
          regsub -all {\\(} \$corr "" corr
          regsub -all {\\)} \$corr "" corr
          regsub -all " SIL " \$corr "" corr
          regsub -all {\\+[^ ]*} \$corr "" corr
          regsub -all {(\\\$|\{|\\})} \$corr "" corr
          regsub -all " [ ]+" \$corr " " corr
          set corr [string trim \$corr]
         
        
          puts "filtered hypo: \$hypo"
          puts "filtered ref : \$corr"
        
          set ali [align \$corr \$hypo]
          set total [llength [lindex \$ali 0]]
          set fehl  [expr [llength [lindex \$ali 2]] + [llength [lindex \$ali 3]] + [llength [lindex \$ali 4]]]
          return [expr 100.0 * (1.0 - \${fehl}.0 / \${total}.0)]
        }
        
        proc testOne { utt } {
          set uttinfo [db get \$utt]
          makeArray infoArray \$uttinfo
          fs eval \$uttinfo
          spass run
          set hypo [spass.stab trace]
         
          puts "\$utt: \$hypo"
        
        set hypo [lrange \$hypo 2 end]
          puts "recogRate: [recogRate \$infoArray(TEXT) \$hypo]\\n"
        }
set fp [open ../step1/testIDs r]
        while { [gets \$fp utt] != -1 } {
          puts "testing utterance \$utt"
          testOne \$utt
        }
        
        exit