hi, I have a list of approximately 300 words and a huge amount of text that I want to scan to know how many times each word appears.
I am using the re module from python:
for word in list_word:
search = re.compile(r"""(\s|,)(%s).?(\s|,|\.|\))""" % word)
occurrences = search.subn("", text)[1]
but I want to know if there is a more efficient or more elegant way of doing this?