/* * calculates the weighted term vector according to the given scoring method */ void Patent::calc_target_wvec(DfTable& dft, Scorer& scorer) { target_wvec.clear(); //const int len = target_tfvec.size(); const double len = vutils::vector_values_sum(target_tfvec).as_float(); for(TermVector::iterator it = target_tfvec.begin(); it != target_tfvec.end(); ++it) { if (dft[it->first] == 0.0) cerr << ucid << ": suspicious df for '" << TD::Convert(it->first) << "': " << dft.mTable[it->first] << ". Skipping this term!" << endl; target_wvec[it->first] = scorer.computeWeight(it->second,dft[it->first],len); } // normalize weighted term vector vutils::normalize_vector(target_wvec); }