Mar-19-2019, 03:23 PM
NLTK is not easy to learn, but to do anagrams, it's as simple as:
see: https://www.nltk.org/book/ch05.html for this example,
and: https://www.nltk.org/ for NLTK package info
Quote:>>> anagrams = nltk.Index((''.join(sorted(w)), w) for w in words)
>>> anagrams['aeilnrt']
['entrail', 'latrine', 'ratline', 'reliant', 'retinal', 'trenail']
see: https://www.nltk.org/book/ch05.html for this example,
and: https://www.nltk.org/ for NLTK package info