This line here was removing the last item from each vector which made their lengths different which caused a whole bunch of chaos down the line (multiplying by undefined).
I have no idea why it's there, but I did notice that it works for the example vector.txt in this project. Maybe something to do with \r and \n?
Also I added this:
if(isNaN(words) || isNaN(size)) {
throw new Error("First line of input text file should be <number of words> <length of vector>. See example data 'vectors.txt' in repo");
}
After this line since that caused me a lot of trouble (I don't think it's mentioned anywhere in the readme).
Thanks for the awesome library!
This line here was removing the last item from each vector which made their lengths different which caused a whole bunch of chaos down the line (multiplying by undefined).
I have no idea why it's there, but I did notice that it works for the example
vector.txtin this project. Maybe something to do with \r and \n?Also I added this:
After this line since that caused me a lot of trouble (I don't think it's mentioned anywhere in the readme).
Thanks for the awesome library!