fozziethebeat / S-Space

The S-Space repsitory, from the AIrhead-Research group
GNU General Public License v2.0
203 stars 106 forks source link

DocumentVectorBuilder ignores USE_TERM_FREQUENCIES_PROPERTY #63

Closed kosloot closed 9 years ago

kosloot commented 9 years ago

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!?

davidjurgens commented 9 years ago

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 https://github.com/fozziethebeat/S-Space/issues/63.