Hi I have a dataframe column contains text. I want to use fasttext model to make prediction from it. I can achieve this by passing an array of text to fasttext model.
import fasttext
d = {'id':[1, 2, 3], 'name':['a', 'b', 'c']}
df = pd.DataFrame(data=d)
I removed '\n' from the series
name_list = df['name'].tolist()
name_list = [name.strip() for name in name_list]
and make prediction model.predict(name_list)
However, I got ValueError: predict processes one line at a time (remove '\n')
I don't have '\n' in the list and '\n' in name_list
returns False
I also found a post with the similar issue but still got the same error.
predictions=[]
for line in df['name']:
pred_label=model.predict(line, k=-1, threshold=0.5)[0][0]
predictions.append(pred_label)
df['prediction']=predictions