FeatureVectorEncoder encoder = new StaticWordValueEncoder("text");
for (String word : doc.elementSet()) {
encoder.addToVector(word, w.weight(word, doc.count(word)), v);
}
if (normalize) {
return v.assign(Functions.div(v.norm(2)));
} else {
return v;
}
}