float division by zero
hello,i don't konw why i run the code s = self.sum() assert(s>=0)
K = len(self.p)
for i in range(K):
self.p[i] = (self.p[i] + smoother)/(s + K*smoother)
An error occurred: File "C:\Users\zoe_zoe\Desktop\BTMpy-master3\BTMpy-master\src\pvec.py", line 99, in normalize self.p[i] = (self.p[i] + smoother)/(s + K*smoother) ZeroDivisionError: float division by zero Could you please tell me how to modify the code?Thanks
I don't know which line is this code, and i just can't exactly solve it.
sorry,i didn't put it very clearly.this code is in pvec.py line99
def normalize(self,smoother=0.0): s = self.sum() assert(s>=0) K = len(self.p) for i in range(K): self.p[i] = (self.p[i] + smoother)/(s + K*smoother)
when i run this, self.sum=0 and self.p=0
you can change code in indexDocs.py line 18 and line 28 to this :
print(' '.join(map(str, wids)), file=wf)
print('%d\t%s' % (wid, w), file=wf)