14 lines
250 B
Python
14 lines
250 B
Python
|
|
|
|
|
|
|
|
def predict(weights, word_to_index, tokenized_text):
|
|
ypred = weights[0] # bias or w0
|
|
for x in tokenized_text:
|
|
if x in word_to_index:
|
|
index = word_to_index[x]
|
|
ypred += weights[index] * 1
|
|
return ypred
|
|
|
|
|