Class NgramMapAddingCallback<V>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void call​(int[] ngram, int startPos, int endPos, V v, java.lang.String words)
      Called for each n-gram
      void cleanup()
      Called once all reading is done.
      java.util.List<int[]> getFailures()  
      void handleNgramOrderFinished​(int order)
      Called when all n-grams of a given order are finished
      void handleNgramOrderStarted​(int order)
      Called when n-grams of a given order are started
      void initWithLengths​(java.util.List<java.lang.Long> numNGrams)
      Called initially with a list of how many n-grams will appear for each order.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NgramMapAddingCallback

        public NgramMapAddingCallback​(NgramMap<V> map,
                                      java.util.List<int[]> failures)
    • Method Detail

      • call

        public void call​(int[] ngram,
                         int startPos,
                         int endPos,
                         V v,
                         java.lang.String words)
        Description copied from interface: LmReaderCallback
        Called for each n-gram
        Specified by:
        call in interface LmReaderCallback<V>
        Parameters:
        ngram - The integer representation of the words as given by the provided WordIndexer
        v - The value of the n-gram
        words - The string representation of the n-gram (space separated)
      • initWithLengths

        public void initWithLengths​(java.util.List<java.lang.Long> numNGrams)
        Description copied from interface: ArpaLmReaderCallback
        Called initially with a list of how many n-grams will appear for each order.
        Specified by:
        initWithLengths in interface ArpaLmReaderCallback<V>
        Parameters:
        numNGrams - maps n-gram orders to number of n-grams (i.e. numNGrams.get(0) is the number of unigrams)
      • getFailures

        public java.util.List<int[]> getFailures()