#ifndef IRSTLM_RANKER_H #define IRSTLM_RANKER_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include class lmtable; // irst lm table class lmmacro; // irst lm for macro tags class IrstlmRanker { private: double probMassThr; std::vector logScores; std::vector probs; std::vector sortedIndex; std::vector batch; int current_line; int maxlineno; int lineno; int sublineno; long double norm; long double current_max; protected: irstlm::lmContainer *m_lmtb; int m_unknownId; int m_lmtb_size; // max ngram stored in the table int m_lmtb_dub; // dictionary upperbound float m_weight; // scoring weight. std::string m_filePath; // for debugging purposes. size_t m_nGramOrder; // max n-gram length contained in this LM. std::vector parseLine(std::string); void printScores(std::vector scores); void insertSortedIndex(long double prob); void reset(); void normalizeProbabilities(); std::ifstream tmtrans; std::string trim(const std::string& o); bool load(const std::string &filePath, float weight); double score(const std::string &frame, double &pp); public: IrstlmRanker(const std::string &filePath, char *mtransPath, std::vector params); ~IrstlmRanker(); int standard(); int fractional(); }; #endif