nltk.misc.wordfinder module¶
- nltk.misc.wordfinder.wordfinder(words, rows=20, cols=20, attempts=50, alph='ABCDEFGHIJKLMNOPQRSTUVWXYZ')[source]¶
Attempt to arrange words into a letter-grid with the specified number of rows and columns. Try each word in several positions and directions, until it can be fitted into the grid, or the maximum number of allowable attempts is exceeded. Returns a tuple consisting of the grid and the words that were successfully placed.
- Parameters
words (list) – the list of words to be put into the grid
rows (int) – the number of rows in the grid
cols (int) – the number of columns in the grid
attempts (int) – the number of times to attempt placing a word
alph (list) – the alphabet, to be used for filling blank cells
- Return type
tuple