python - Finding the common words between two text corpus in NLTK -


i new nltk , trying something.

what best way find common words between 2 bodies of text? basically, have 1 long text file text1, , text2. want find common words appear in both files using nltk.

is there direct way so? best approach?

thanks!

it seems me unless need special regards language processing, don't need nltk:

words1 = "this simple test of set intersection".lower().split() words2 = "intersection of sets easy using python".lower().split()  intersection = set(words1) & set(words2)  >>> set(['of', 'is', 'intersection']) 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -