Find words that differ from your name by the fewest characters.
Run this code to get a list of dictionary words:
This returns a list of all the words in the dictionary. The list is automatically shortened because it is very long:
You can select particular words by giving DictionaryLookup a word pattern.
This gives the list of words that begin with “soph”:
Compute how many characters have to be edited to get from “rhino” to “rhyno”. Try different words:
EditDistance tells you how many characters you have to edit to get from one word to another.
You have to make one edit to change “rhino” to “rhyno” (change “i” to “y”):
You have to make two edits to change “fish” to “fin” (delete “h” and change “s” to “n”):
Find words that differ by fewer than three edits from “sophia”. Try other names:
Select selects items in a list that pass a test.
This selects words whose lengths are less than 4 characters:
The test StringLength[#]<4& is what’s called a “pure function”. When it’s used in Select, each item in turn in the list replaces the hash sign (#), and the function returns True if that item’s length is less than 4, and otherwise False. Items that return True are selected and those that return False are rejected.
Use Select to select dictionary words whose distance from “sophia” is less than 3 edits:
Find collections of words that differ by edit distances up to 3 from “sophia”. Try other names or words:
Table makes lists of things.
This uses Table to make a list of the first three even numbers:
This makes a list of lists. Each list is the numbers from 1 to n as n goes from 1 to 3:
This makes a list of lists of words whose edit distances from “sophia” are n as n goes from 1 to 3:
Format the result as a grid:
Include the edit distance in the list of results:
Format the result as a grid with edit distances in the first column and words in the second:
Align the grid columns on the left:
Add divider lines to make the grid more readable:
Share It—make a website to find words near your name:
Deploy a form that asks for a name and gives a table of words near it:
Click the link in the output to visit the site.
Tell the world about your creation by sharing the link via email, tweet or other message.