Menu

Only one path in lattice??

Help
2005-02-14
2012-09-22
  • Mike LeBeau

    Mike LeBeau - 2005-02-14

    Hi,

    For a project I'm working on I need Sphinx to return to me a lattice, or even better, list of candidate sentences with scores. The lattice, however, seems to always contain one and only one path in it, namely, the one that it hypothesized as the best possibility. Am I missing something here? Is there a property to control the 'bushiness' of the lattice? Thanks!

    -mike

     
    • Willie Walker

      Willie Walker - 2005-02-14

      Hi Mike:

      There is a demo in demo/sphinx/lattice that demonstrates how to build a lattice from a result. In order to turn this on, you need to set the "buildWordLattice" property to "true" in the config file. Here's a snippet from the lattice demo config file:

      <component name="wordPruningSearchManager" 
      type="edu.cmu.sphinx.decoder.search.WordPruningBreadthFirstSearchManager">
          <property name="logMath" value="logMath"/>
          <property name="linguist" value="lexTreeLinguist"/>
          <property name="pruner" value="trivialPruner"/>
          <property name="scorer" value="threadedScorer"/>
          <property name="activeListManager" value="activeListManager"/>
          <property name="growSkipInterval" value="0"/>
          <property name="checkStateOrder" value="false"/>
          <property name="buildWordLattice" value="true"/>
          <property name="acousticLookaheadFrames" value="1.7"/>
          <property name="relativeBeamWidth" value="${relativeBeamWidth}"/>
      </component>
      

      If you're not doing this in your work, then you might run into problems. If you are setting the property, however, please let me know and we can start digging further.

      Hope this helps,

      Will

       
      • Mike LeBeau

        Mike LeBeau - 2005-02-14

        Hi Willie,

        Thanks for the suggestion! That appears to have already been sent, however I'd like to take a look at the entire lattice demo before making you help me any further - I might be able to see what I'm doing wrong from that. As it turns out, the reason I never saw that demo is because it's not in my demo directory! I have confidence, hellodigits, hellongram, helloworld, transcriber, wavfile, and zipcity, but no lattice. Also, the link to that demo's README at the Sphinx FAQ leads to a 404.

        Please let me know if you can, how I can get a hold of this demo to try to figure this out. Thanks again!!

        -mike

         
        • Willie Walker

          Willie Walker - 2005-02-14

          Oh dear! I forgot that we added this to the CVS repository after the alpha release. You can get the latest and greatest code directly from the CVS repository. The instructions can be found here:

          https://sourceforge.net/cvs/?group_id=1904
          

          Use sphinx4 as the module name.

          Hope this helps,

          Will

           
          • Mike LeBeau

            Mike LeBeau - 2005-02-14

            Thanks for the help, Will. I'll try to work this in a second, but this actually leads me to another question:

            If I'm retrieving the result after it's been returning from recognizer.recognize() in the BatchModeRecognizer, what would you recommend as the simplest way to rescore sentence confidences before the actual 'best sentence' is returned to the batch process?

            Thanks!

            -mike

             
    • Mike LeBeau

      Mike LeBeau - 2005-02-15

      Well, I haven't been successful in trying to get anything more out of the lattice, and I can't figure out why. Could it be some setting in the config.xml file I'm missing? Following the LatticeDemo.java example, I added this to BatchModeRecognizer's decode() function, inside the while loop that loops over all the batch items. I added this just after the call to recognizer.recognize():

      Lattice lattice = new Lattice(result);
      LatticeOptimizer optimizer = new LatticeOptimizer(lattice);
      optimizer.optimize();
      lattice.dumpAllPaths();
      System.out.println("best was: " + result.getBestResultNoFiller());

      And the result I get, still, is just one possible path, as shown here:

       [java] REF:       in scotland an official war against drugs is under way
       [java] HYP:       in scotland unofficial war against drugs is underway
      
       [java]    Accuracy: 60.000%    Errors: 4  (Sub: 2  Ins: 0  Del: 2)
       [java]    Words: 10   Matches: 6    WER: 40.000%
       [java]    Sentences: 1   Matches: 0   SentenceAcc: 0.000%
       [java]    This  Time Audio: 3.84s  Proc: 44.40s  Speed: 11.56 X real time
       [java]    Total Time Audio: 3.84s  Proc: 44.40s  Speed: 11.56 X real time
       [java]    Mem  Total: 197.81 Mb  Free: 35.97 Mb
       [java]    Used: This: 161.85 Mb  Avg: 161.85 Mb  Max: 161.85 Mb
       [java]  <s> ++smack++ ++breath++ <sil> in scotland unofficial war <sil> against drugs is <sil> underway <sil> </s>
       [java] best was: in scotland unofficial war against drugs is underway
       [java] # ----------------------------- Timers----------------------------------------
      

      ...

      As you can see, that dumpAllPaths() call only shows one path, which doesn't make much sense. Certainly the recognizer is producing other hypotheses? Does this help you to help me in figuring out what I'm missing? Thanks!

      -mike

       
      • Willie Walker

        Willie Walker - 2005-02-15

        Hi Mike:

        I made these same exact changes to BatchModeRecognizer and ran the wsj5k_trigram test in the tests/performance/wsj5k directory.

        I also modified any occurrence of buildWordLattice in the wsj5k.config.xml file to the following:

        <property name="buildWordLattice" value="true"/>

        The thing worked like a charm. What you might be running into is that the config.xml file is created from wsj5k.config.xml. So...if you modify config.xml, it's just going to get overwritten.

        Will

         
  • David Lancashire

    I'm working on something similar. First step is to look at the file
    test_ps_nbest.c in the tests folder. It shows how to step through the top N
    hypotheses and print out sentence and word level probability data.
    .

     

Log in to post a comment.