我有一个 NLP 项目,我想删除关键字中只出现一次的单词。也就是说,对于每一行,我都有一个关键字列表及其频率。
我想要类似的东西
if the frequency for the word in the whole column ['keywords'] ==1 then replace by "".
我无法逐字测试。所以我的想法是创建一个包含所有单词的列表并删除重复项,然后对于此列表中的每个单词 count.sum 然后删除。但我不知道该怎么做。有任何想法吗?谢谢!
这是我的数据的样子:
样品头(4)
ID keywords age sex
0 1 fibre:16;quoi:1;dangers:1;combien:1;hightech:1... 62 F
1 2 restaurant:1;marrakech.shtml:1 35 M
2 3 payer:1;faq:1;taxe:1;habitation:1;macron:1;qui... 45 F
3 4 rigaud:3;laurent:3;photo:11;profile:8;photopro... 46 F