void calcRelativity(struct Option_Info option, struct Word word[], int word_cnt, std::map< std::string, double > entropy_dict){ for(int i = 0; i < word_cnt; i++){ if( isAllUpper(word[i].word_name) ){ //如果word全部是大写的,则默认不参与匹配 word[i].match_num =0; word[i].match_ratio = 0.0; continue; } for(int j =0 ; j < option.dict.size(); j++){ if( kmp_ignorecase( word[i].word_name, option.dict[j].c_str() ) != -1 /*&& word[i].match_num < option.dict.size()*/){ word[i].match_num++; word[i].match_detail.push_back(j); //此处的记录是有顺序的 } } word[i].match_ratio = calcRatio(option, word[i], entropy_dict); word[i].match_similarity = simhash( word[i], option, entropy_dict); } return; }
bool isAllUpperUTF8(const char * s) { return isAllUpper(s,0); }