Self-contained TWL06 Dictionary Module (515 KB)

Category: Python - Miscellaneous

A convenient, self-contained, 515 KB Scrabble dictionary module, ideal
for use in word games.

Functionality:


Check if a word is in the dictionary.
Enumerate all words in the dictionary.
Determine what letters may appear after a given prefix.
Determine what words can be formed by anagramming a set of letters.


Sample usage:

>>> import twl
>>> twl.check('dog')
True
>>> twl.check('dgo')
False
>>> words = set(twl.iterator())
>>> len(words)
178691
>>> twl.children('dude')
['$', 'd', 'e', 's']
>>> list(twl.anagram('top'))
['op', 'opt', 'pot', 'to', 'top'] Date: 03 February, 2012


Dawg - Dictionary - Scrabble - Trie - Twl06 - Word

Homepage: http://code.activestate.com/recipes/577835-self-contained-twl06-dictionary-module-515-kb/?in=lang-python

Developer: Michael Fogleman

License: Freeware

Operating System: Windows

Add a Comment

all are required fields

     
What do you think of this resource?

Select Your Rate:

Votes:0

 

Related Scripts Download

Scrabble Dictionary is both a dictionary and word builder for Scrabble®-like games.

developer Developer: scrabbledict
license License: GNU General Public License (GPL)
operating systems Operating System: OS Independent (Written in an interpreted language)


This is a great way to get repeat visitors.

developer Developer: Intelliscript.net
license License: Freeware
operating systems Operating System: Linux, Unix, Windows


Have you ever thought of adding a Vocabulary List to your site.

developer Developer: t-dreams.com
license License: Freeware
operating systems Operating System: All


This script allows you to record the order in which items are added.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script is a template for a program that opens, saves, deletes and adds entries to a dictionary object.

developer Developer: ww25.uselesspython.com
license License: Freeware
operating systems Operating System: All


Glossword Glossary Compiler helps you to create and publish online multilingual dictionary, glossary, or reference.

developer Developer: SourceForge.net
license License: Freeware
operating systems Operating System: All


This script shows a clean way of implementing a 'switch' statement in Python via a dictionary container.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


The list and tuple index() method and in operator test for element containment, unlike similar tests for strings, which checks for sub-strings:

>>> "12" in "0123"
True
>>> [1, 2] in [0, 1, 2, 3]
False


These two functions, search and rsearch, act like str.

developer Developer: Steven D'Aprano
license License: Freeware
operating systems Operating System: Windows


This will give a result that is more than a permutation, but all possible combinations.

developer Developer: Yang
license License: Freeware
operating systems Operating System: Windows