【发布时间】:2019-07-25 09:23:51
【问题描述】:
我有一个字符串和一个单词列表,我想检查它们是否存在于给定的文本字符串中。我正在使用以下逻辑.....还有其他方法可以优化它吗:-
import re
text="""
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics.
Its high-level built in data structures, combined with dynamic typing and dynamic binding, make
it very attractive for Rapid Application Development"""
tokens_text=re.split(" ",text)
list_words=["programming","Application"]
if (len(set(list_words).intersection(set(tokens_text)))==len(list_words)):
print("Match_Found")
【问题讨论】:
标签: python pandas python-2.7 text nlp