for(String ft : ftvec1) {
if(noWeight) {
score1++;
map1.put(ft, 1.f);
} else {
FeatureValue fv = FeatureValue.parseFeatureAsString(ft);
float v = fv.getValue();
score1 += (v * v);
String f = fv.getFeature();
map1.put(f, v);
}
}
double l1norm1 = Math.sqrt(score1);
float dotp = 0.f;
double score2 = 0.d;
for(String ft : ftvec2) {
if(noWeight) {
score2++;
if(map1.containsKey(ft)) {
dotp++;
}
} else {
FeatureValue fv = FeatureValue.parseFeatureAsString(ft);
float v2 = fv.getValue();
score2 += (v2 * v2);
String f2 = fv.getFeature();
Float v1 = map1.get(f2);
if(v1 != null) {
dotp += (v1.floatValue() * v2);
}
}