}
}
private List<HMapSFW> buildDocVectors(List<HMapSIW> term2tfVectors, float avgLen,
HMapSIW dfTable) {
Bm25 mModel = new Bm25();
// set number of docs
mModel.setDocCount(term2tfVectors.size());
// set average doc length
mModel.setAvgDocLength(avgLen);
// tf-idf computation
List<HMapSFW> docVectors = new ArrayList<HMapSFW>();
for (HMapSIW enDoc : term2tfVectors) {
HMapSFW v = new HMapSFW();
int docLen = 0;
for (Entry<String> item : enDoc.entrySet()) {
int tf = item.getValue();
docLen += tf;
}
float sum2 = 0;
for (Entry<String> item : enDoc.entrySet()) {
String term = item.getKey();
int tf = item.getValue();
int df = dfTable.get(term);
mModel.setDF(df);
float score = mModel.computeDocumentWeight(tf, docLen);
if (score > 0) {
v.put(term, score);
sum2 += score * score;
}
}