double multipleGuess01::getMarginalScore(vector<simpleItem> & vecItems, simpleItem & appItem) { double prevScore = queryScore(vecItems); // cout << "prevScore" << prevScore << endl; vecItems.push_back(appItem); double appScore = queryScore(vecItems); // cout << "appScore" << appScore << endl; vecItems.pop_back(); return appScore - prevScore; }
int main(){ //pipeline: lm::ngram::Model m("text.arpa"); ScoreQueryer sq(m, m.GetVocabulary()); auto errors = loadTaggedErrorText("./holbrook-tagged.dat"); auto vocabs = populateVocab("text", sq); auto matches = matchTags(errors, vocabs); auto matchedScores = queryScore(sq, matches); std::vector<int> counts = {1, 5, 10, 15, 20, INT_MAX}; for(auto i : counts) matchesInFirstN(matchedScores,i); //std::cout<<std::get<0>(matchedScores[0])<<" "<<std::get<2>(matchedScores[0])[0].first<<std::endl; return 0; }
double AuxSearchSpace:: queryFutureCost(BITVECTOR bvec) { double result=0; int start=0,stop=0; for(start=0;start<(int)bvec.size();start++) { if(bvec[start]==true)continue; for(stop=start;stop<(int)bvec.size();stop++) { if(bvec[stop]==true)break; } stop=stop-1; if(stop<start)break; result+=queryScore(make_pair(start,stop)); start=stop+1; } return result; }