如何删除这些带有单词边界的停止词?

2024-05-16 05:30:59 发布

您现在位置:Python中文网/ 问答频道 /正文

当这些停止词被一个词的边界包围时,试图删除它们。 没用了,有什么想法吗?你知道吗

stop_words = ['industries','inc','cor','enterprises','international','studios','llc','ltd','systems','housewares','incorporation','corporation','electronics','group','usa', 'entertainment','distributors',',','exclusive','artist','illustrator', 'actor', 'director', 'director','editor', 'translator', 'creator', 'photographer', 'ntributor','tm','writer','publisher','producer', 'performer', 'pl', 'author','\(\)', 'co', 'announcement']

for i in stop_words:
    df_input['clean_brand'] = df_input.clean_brand.replace('\b%s\b' %i,'', 
    regex=True)

Tags: cleandfinputinc边界stopdirectorwords