DocumentVectorBuilder ignores USE_TERM_FREQUENCIES_PROPERTY
Closed this issue · 1 comments
I tried to use the DocumentVectorBuilder class while honouring TERM frequencies.
This fails, because of a bug (IMHO) in the add Method:
public void add(DoubleVector dest, Vector src, int factor) {
if (src instanceof SparseVector) {
int[] nonZeros = ((SparseVector) src). getNonZeroIndices();
for (int i : nonZeros)
dest.add(i, src.getValue(i).doubleValue());
} else {
for (int i = 0; i < src.length(); ++i)
dest.add(i, src.getValue(i).doubleValue());
}
}
the 'factor' parameter is NOT used at all!?
Thanks for spotting this bug. Yes, the code you mention is not properly
taking into account the factor parameter. I have fixed this issue in the
S-Space trunk.
On Mon, Apr 13, 2015 at 5:51 AM, kosloot notifications@github.com wrote:
I tried to use the DocumentVectorBuilder class while honouring TERM
frequencies.
This fails, because of a bug (IMHO) in the add Method:public void add(DoubleVector dest, Vector src, int factor) {
if (src instanceof SparseVector) {
int[] nonZeros = ((SparseVector) src). getNonZeroIndices();
for (int i : nonZeros)
dest.add(i, src.getValue(i).doubleValue());
} else {
for (int i = 0; i < src.length(); ++i)
dest.add(i, src.getValue(i).doubleValue());
}
}the 'factor' parameter is NOT used at all!?
—
Reply to this email directly or view it on GitHub
#63.