import nltk
from nltk.tokenize import word_tokenize
txt = "finding a common place isn't commonly available among commoners place"
fd = nltk.FreqDist()
for w in word_tokenize(a.lower()):
fd[w] += 1
I have the above script that works fine. If I do fd['place']
I get 2, if I type fd['common']
I get 1.
Is it possible to type something similar to fd['common*']
(which doesn't work) to obtain 3 and possibly a list of those matches? The three matches would be (common, commonly, commoners)
I'm assuming it has something to do with regex
but not sure how to implement with FreqDist()
If not, are there any other packages that might do that?