📄 ngrm_06.cc
字号:
// file: $isip/class/stat/NGramModel/ngrm_06.cc// version: $Id: ngrm_06.cc,v 1.2 2002/08/08 21:53:44 zheng Exp $//// isip include files//#include "NGramModel.h"// method: getScore//// arguments:// const VectorLong& index: (input) SearchSymbol index sequence// // return: a status //// this method returns the score represented by the ngram give a// SearchSymbol index sequence//boolean NGramModel::getScore(const VectorLong& index_a, float& score_a) { // define temporary variables used in function // NGramNode* ngnode = NULL; long num = index_a.length(); VectorLong final_index; long i = 0; // get the correct ngram node // for (i = 0; i < num; i++) { // find the successive nodes // ngnode = gram_hash_d.get(index_a(i)); // if the ngram word sequences exist // if (ngnode != NULL) { final_index.setLength(final_index.length()+1); final_index(final_index.length()-1).assign(index_a(i)); } // if any of these ngram word sequences do not exist // else{ // don't allow forms like AXB or AXX // if ( final_index.length() > 0 ){ return false; } } } // end for loop if ( final_index.length() == 0 ){ return false; } score_a = getScore(final_index); // exit gracefully // return true;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -