Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using if statements
#2
NLTK is not easy to learn, but to do anagrams, it's as simple as:

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
Reply


Messages In This Thread
Using if statements - by bradystroud - Mar-19-2019, 09:13 AM
RE: Using if statements - by Larz60+ - Mar-19-2019, 03:23 PM
RE: Using if statements - by ichabod801 - Mar-19-2019, 03:40 PM
RE: Using if statements - by bradystroud - Mar-20-2019, 06:56 AM
RE: Using if statements - by ichabod801 - Mar-20-2019, 01:55 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020