Joshua
open source statistical hierarchical phrase-based machine translation system
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
src/kenlm/lm/return.hh
00001 #ifndef LM_RETURN_H
00002 #define LM_RETURN_H
00003 
00004 #include <stdint.h>
00005 
00006 namespace lm {
00007 /* Structure returned by scoring routines. */
00008 struct FullScoreReturn {
00009   // log10 probability
00010   float prob;
00011 
00012   /* The length of n-gram matched.  Do not use this for recombination.
00013    * Consider a model containing only the following n-grams:
00014    * -1 foo
00015    * -3.14  bar
00016    * -2.718 baz -5
00017    * -6 foo bar
00018    *
00019    * If you score ``bar'' then ngram_length is 1 and recombination state is the
00020    * empty string because bar has zero backoff and does not extend to the
00021    * right.
00022    * If you score ``foo'' then ngram_length is 1 and recombination state is
00023    * ``foo''.
00024    *
00025    * Ideally, keep output states around and compare them.  Failing that,
00026    * get out_state.ValidLength() and use that length for recombination.
00027    */
00028   unsigned char ngram_length;
00029 
00030   /* Left extension information.  If independent_left is set, then prob is
00031    * independent of words to the left (up to additional backoff).  Otherwise,
00032    * extend_left indicates how to efficiently extend further to the left.
00033    */
00034   bool independent_left;
00035   uint64_t extend_left; // Defined only if independent_left
00036 
00037   // Rest cost for extension to the left.
00038   float rest;
00039 };
00040 
00041 } // namespace lm
00042 #endif // LM_RETURN_H