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
Post a Comment