Example #1
0
 public WordPruningBreadthFirstLookaheadSearchManager(Linguist.Linguist linguist, Linguist.Linguist fastmatchLinguist, ILoader loader,
                                                      IPruner pruner, IAcousticScorer scorer, ActiveListManager activeListManager,
                                                      ActiveListFactory fastmatchActiveListFactory, bool showTokenCount, double relativeWordBeamWidth,
                                                      int growSkipInterval, bool checkStateOrder, bool buildWordLattice, int lookaheadWindow, float lookaheadWeight,
                                                      int maxLatticeEdges, float acousticLookaheadFrames, bool keepAllTokens)
     : base(linguist, pruner, scorer, activeListManager, showTokenCount, relativeWordBeamWidth, growSkipInterval,
            checkStateOrder, buildWordLattice, maxLatticeEdges, acousticLookaheadFrames, keepAllTokens)
 {
     _loader                     = loader;
     _fastmatchLinguist          = fastmatchLinguist;
     _fastmatchActiveListFactory = fastmatchActiveListFactory;
     _lookaheadWindow            = lookaheadWindow;
     _lookaheadWeight            = lookaheadWeight;
     if (lookaheadWindow < 1 || lookaheadWindow > 10)
     {
         throw new ArgumentException("Unsupported lookahead window size: " + lookaheadWindow
                                     + ". Value in range [1..10] is expected");
     }
     _ciScores  = new LinkedList <FrameCiScores>();
     _penalties = new HashMap <Integer, Float>();
     if (loader is Sphinx3Loader && ((Sphinx3Loader)loader).HasTiedMixtures())
     {
         ((Sphinx3Loader)loader).SetGauScoresQueueLength(lookaheadWindow + 2);
     }
 }
Example #2
0
        /**
         * /// Creates the emitting and non-emitting active lists. When creating the non-emitting active lists, we will look at
         * /// their respective beam widths (eg, word beam, unit beam, state beam).
         */
        private void CreateActiveLists()
        {
            int nlists = _activeListFactories.Count;

            for (int i = 0; i < CurrentActiveLists.Length; i++)
            {
                int which = i;
                if (which >= nlists)
                {
                    which = nlists - 1;
                }
                ActiveListFactory alf = _activeListFactories[which];
                CurrentActiveLists[i] = alf.NewInstance();
                //this.LogDebug("Added new item {0} at index {1} for currentActiveList",currentActiveLists[i],i);
            }
        }
Example #3
0
 /**
  * ///
  * /// @param linguist
  * /// @param pruner
  * /// @param scorer
  * /// @param activeListFactory
  * /// @param showTokenCount
  * /// @param relativeWordBeamWidth
  * /// @param growSkipInterval
  * /// @param wantEntryPruning
  */
 public SimpleBreadthFirstSearchManager(Linguist.Linguist linguist, IPruner pruner,
                                        IAcousticScorer scorer, ActiveListFactory activeListFactory,
                                        Boolean showTokenCount, double relativeWordBeamWidth,
                                        int growSkipInterval, Boolean wantEntryPruning, int totalHmms)
 {
     _name                     = GetType().Name;
     LogMath                   = LogMath.GetLogMath();
     Linguist                  = linguist;
     _pruner                   = pruner;
     _scorer                   = scorer;
     ActiveListFactory         = activeListFactory;
     _showTokenCount           = showTokenCount;
     _growSkipInterval         = growSkipInterval;
     _wantEntryPruning         = wantEntryPruning;
     _totalHmms                = totalHmms;
     _logRelativeWordBeamWidth = LogMath.LinearToLog(relativeWordBeamWidth);
     KeepAllTokens             = true;
 }
Example #4
0
        public override void NewProperties(PropertySheet ps)
        {
            LogMath = LogMath.GetLogMath();
            _name   = ps.InstanceName;

            Linguist          = (Linguist.Linguist)ps.GetComponent(PropLinguist);
            _pruner           = (IPruner)ps.GetComponent(PropPruner);
            _scorer           = (IAcousticScorer)ps.GetComponent(PropScorer);
            ActiveListFactory = (ActiveListFactory)ps.GetComponent(PropActiveListFactory);
            _showTokenCount   = ps.GetBoolean(PropShowTokenCount);

            double relativeWordBeamWidth = ps.GetDouble(PropRelativeWordBeamWidth);

            _growSkipInterval         = ps.GetInt(PropGrowSkipInterval);
            _wantEntryPruning         = ps.GetBoolean(PropWantEntryPruning);
            _logRelativeWordBeamWidth = LogMath.LinearToLog(relativeWordBeamWidth);

            KeepAllTokens = true;
        }
Example #5
0
        public override void NewProperties(PropertySheet ps)
        {
            base.NewProperties(ps);

            _fastmatchLinguist          = (Linguist.Linguist)ps.GetComponent(PropFastmatchLinguist);
            _fastmatchActiveListFactory = (ActiveListFactory)ps.GetComponent(PropFmActiveListFactory);
            _loader          = (ILoader)ps.GetComponent(PropLoader);
            _lookaheadWindow = ps.GetInt(PropLookaheadWindow);
            _lookaheadWeight = ps.GetFloat(PropLookaheadPenaltyWeight);
            if (_lookaheadWindow < 1 || _lookaheadWindow > 10)
            {
                throw new PropertyException(typeof(WordPruningBreadthFirstLookaheadSearchManager).Name, PropLookaheadWindow,
                                            "Unsupported lookahead window size: " + _lookaheadWindow + ". Value in range [1..10] is expected");
            }
            _ciScores  = new LinkedList <FrameCiScores>();
            _penalties = new HashMap <Integer, Float>();
            if (_loader is Sphinx3Loader && ((Sphinx3Loader)_loader).HasTiedMixtures())
            {
                ((Sphinx3Loader)_loader).SetGauScoresQueueLength(_lookaheadWindow + 2);
            }
        }