Make one word from another

Linguistic games allow not only to fill the time with interesting entertainment, but also develop observation, memory and attention. In particular, to compose a word from another, you will need a rich vocabulary and the ability to analyze and synthesize information.

How to make a word from another

How to make a word from another

It is necessary

  • paper
  • a pen

Instructions

Step 1

Choose long enough words with vowels if you are just learning how to form words from others. After a long training, you will be able to operate with more complex words in which consonants are abundant.

Step 2

Study the word carefully for the presence of sound combinations that are most familiar to your ear — they will immediately tell you the direction in which you can move to form a new word. In addition, the original set of letters itself can offer you a version of a new word that does not require any rearrangements: for example, in the word «shipwreck» you will quickly find its independent semantic part «wreck», as well as «bark». Based on the sound of «shipwreck» and «wreck», you can hear another word: «decoration».

Step 3

Write the word down on a piece of paper and look at it carefully. Try to choose not letters, but syllables, and select possible combinations for them. So, if you are trying to form a word from the already mentioned shipwreck, start with the syllable «ko». What can be attached to it? Start with three-letter words before moving on to more complex combinations: in the word «shipwreck» there are letters k, o, p, a, b, l, e, w, n, and. The syllable «ko» is added to, l, n. So, you have already composed six words.

Step 4

Play with syllable permutations to form more difficult words. Try even the most meaningless combinations: they themselves will tell you what and where to change, so that you get a word that is present in Russian.

Step 5

Do not waste too much time on one letter or syllable: you will begin to think that this is absolute nonsense, even if this word exists in the language. This happens if you repeat for a long time, for example, «milk». After several reproductions of a person, doubts arise: is there such a word at all, or is it a figment of his imagination?

Step 6

As you improve, gradually get rid of conscious control so that the natural sense of the native language can take part in the composition of words: it will intuitively lead you to the possible correct combinations. Soon, this task will no longer be difficult for you and will develop into exciting entertainment. In addition, you can compose words from one and using foreign languages: this is a good opportunity to strengthen your knowledge and develop your vocabulary.

Popular by topic

Everything You Need to Know about Word Unscramblers

Love playing Scrabble®? You know how difficult it is to find words among a bunch of letters. Sure, seeing vowels and consonants is everything some people need to win over any jumble.

However, figuring out a letter combination that forms an anagram isn’t a skill everyone possesses. If you’re one of those requiring word scramble help, I’ve got good news for you. It’s easy to figure out the missing word, even if you aren’t sure about it, especially if you are playing your favorite board game online.

You can discover new ways to make playing the game easy. Read on and discover your way to mastering any jumble.

What is a Word Unscramble Tool?

A word unscramble tool also goes by the name of «letter unscrambler» or «jumble solver.» It’s a tool that finds words hidden within jumbled letters.

An anagram solver lets you find all the words made from a list of letters presented in any order. You only need to locate the online tool and, in the search bar, enter any letters you can think of, including wild cards.

Many word solvers also let you choose a game dictionary. It gives you extra leeway to search with advanced options if you want to cheat with specific rules.

You don’t have to think of them as some unscramble cheat. Instead, using a scramble solver can help you study and practice your next Scrabble® or Words With Friends® match.

How to Unscramble Words and How to Use Advanced Options

Steps and Examples

The first thing you need to do is to find the best tool. Then, the steps are straightforward. Even more so, most tools follow the same steps; you’ll have a hard time getting lost with any scramble solver.

  • Step 1: Enter each of your current letter tiles in the search box. The maximum is fifteen. You can use two blank tiles («?» or SPACE).
  • Step 2: Hit the Search button. You will get to see different words coming up from the generator. Click on any word to see its definition. 

Want to get even better at the popular word game? Alternatively, you can also use Advanced Options to add in more complexity to your favorite word game. So, you can decide what letter or letter pairs the word should start with, or the letter you will find at the end. A wildcard letter can generate many letter ideas.

You can also decide how many letters the word will contain, or the word pattern. For instance, you can search for high-scoring words that have the letter ‘n’ in a specific position. When you are done, all you need to do is hit the search button again.

Then, you can see the words database categorized by the number of letters.

Unscramble Words Methods

There are two approaches when it comes to word scramble help. Each method sets itself apart depending on how you’re solving the anagram.

1. Unscramble Letters

The first approach is to unscramble letter combinations to make words. This way tends to be the most commonly sought-after because it’s easier to score more points and win when you’re not focusing on a specific word.

When we talk about having to unscramble letters to make words, the possibilities are more extensive.

This word scramble help consists of what you learned earlier. The unscrambler tool receives combinations of letters and proceeds to unscramble them into different words.

If your objective is to rely less on that random wildcard and increase your vocabulary, this way is the best.

2. Unscramble Words

This type of word solver is much more restrictive. If you go with it, you’re choosing to unscramble jumbled words. It’s the closest you can get to a literal anagram.

To unscramble this anagram is much more difficult. You’re going after an individual result instead of many possibilities.

Online tools to unscramble jumbled words are usually more difficult to find. Often, the easiest way to unscramble a specific word with online help is to use filters. This way, you can limit the results and narrow them down to what you want.

Tips and Tricks to Unscramble Long Words

Words longer than five letters can be a nightmare. However, there are a few tips we can give you to make your life easier.

Tip 1: Focus on Syllables

Firstly, you can exploit the mighty syllable. People make words from syllables, not letters. You can merge vowels and consonants and form letter combinations (like suffixes and prefixes) that often go together. This way makes it easier to visualize possible words.

Tip 2: Vowels vs Consonants

Another way is to separate consonants and vowels. It often makes answers more noticeable than having everything jumbled.

Tip 3: Separate the Letter S

Lastly, the chances are that your language pluralizes words by adding an S in the end. If you’re playing Scrabble® and have a noisy S, taking up space, you probably can place it as adjacent letters at the end of your next word.

Most Popular Unscrambling Examples

There are ways to make the next puzzle game more exciting. Additionally, you can use these «rules» to focus on particular vocabularies you want to improve.

A. Three Word Finding Examples by Length

The first example is to unscramble anagrams into a set number of random letters using advanced options.

  1. Make 7 letter words with these letters: AHSJFTSIKATL
    Fajitas
    Saltish
    Khalifa
  2. Make 6 letter words with these letters: OKLIYNCMZHOF
    Colony
    Flinch
    Kimono
  3. Make 5 letter words with these letters: MGJDUHSIAOET
    Audio,
    Amuse
    Guest

B. Two Word Solving Examples by Topic

The other way to solve a letter scramble puzzle is to focus on a topic. You can choose specific categories for your anagram, or you can limit your jumble to a certain language like German or French to make things harder!

  1. Find home utilities with these letters: KSIETNCHOFRK
    Kitchen
    Fork
    Knife
  2. Find food-related words with these letters: AJDOQIUESHNM
    Quinoa
    Queso
    Squid

If you are looking to get better in the board game faster, this Word Unscrambler is the one you need to check out – for sure! For Crossword Puzzles lovers, we have a different tool. Try it here when you are stuck in solving any clue.

Anagram Solver is a tool used to help players rearrange letters to generate all the possible words from them. You input the letters, and Anagram Maker gives you the edge to win Scrabble, Words With Friends, or any other word game. No matter the length or difficulty of the word, Anagram Solver provides all available word options.

Anagrams — Definition and Examples

Have you ever heard of an anagram? Maybe you recognize the term, but you’re not exactly sure what it means. On the other hand, you might be an expert at using anagrams and have fun with them when playing various word games and board games.

What is an Anagram?

Anagrams are words or phrases you spell by rearranging the letters of another word or phrase. For instance, fans of the Harry Potter series know that Lord Voldemort’s full name is actually an anagram of his birth name, and some people even play games challenging one another to make anagrams still relevant to the original term. For example, «schoolmaster» can be turned into «the classroom», «punishments» becomes «nine thumps», and «debit card» turns into «bad credit».

The only rule is that all the letters from the original word or phrase must be used when they’re reordered to say something entirely different.

History of Anagrams

Historians suggest that anagrams actually originated in the 4th century BC, but weren’t commonly used until the 13th century AD when they were sometimes thought of as mystical. Imagine that!

20 Cool Anagram Examples

Whatever your level of knowledge, Word Finder can be a great tool to assist you to unscramble letters and identify anagrams when playing online and offline games. Here are some examples to help you become more familiar with anagrams ─ starting with the word “anagram” itself.

  1. anagram = nag a ram
  2. below = elbow
  3. study = dusty
  4. night = thing
  5. act = cat
  6. dessert = stressed
  7. bad credit = debit card
  8. gainly = laying
  9. conversation = voice rants on
  10. eleven plus two = twelve plus one
  11. they see = the eyes
  12. funeral = real fun
  13. meteor = remote
  14. the classroom = schoolmaster
  15. meal for one = for me alone
  16. sweep the floor = too few helpers
  17. older and wiser = I learned words
  18. video game = give a demo
  19. coins kept = in pockets
  20. young lady = an old guy

Anagram Solver for Scrabble, Words with Friends and Crosswords

How does anagramming help with word games? Easily, it forces you to start reimagining your tiles in a less confusing way. You’ll start looking at how to make any phrase or word instead of simply struggling with what appears on the board and the rack.

Some people are naturals at coming up with anagrams. However, it’s a rare person who can look at language and expertly rearrange the consonants and vowels to arrive at interesting or entertaining new compositions.

What is an Anagram Solver?

An anagram solver is a terrific tool that many people like to rely on to create different letter combinations.

How to Use an Anagram Solver in 3 Simple Steps

  • Step #1: Recognize prefixes and suffixes.

Following are common ones:

Some prefixes that start words ─ ab, ad, dis, de, ex, re, sub, un

Some suffixes that end words ─ ed, er, ing, ism, ly, ment, ness, tion

  • Step #2: Pick them out.
  • Step #3: Reorder the letters into new words.

Anagramming Example

One example is that the word “painter” could become “repaint” by moving the suffix to the beginning so that it becomes a prefix. Alternatively, the letters could be rearranged to make the word “pertain”.

Using Anagram Maker

Now, you may not see how anagramming can really help you win at games such as Scrabble or Words with Friends. However, just think about it for a moment. If you have the board in front of you, and it is loaded with an array of pre-existing words and open spaces, your strategy demands you consider the most lucrative moves. It is not just about making the longest word, but more about the words that give the most points. Anagram generators, like ours, give you solutions with anything from two to six or more letters. You can then use them to plug into the available spaces, finding the highest points possible.

Scrabble Anagram Maker

Seasoned Scrabble players will already know the value of using an anagram generator. After pulling seven tiles from the Scrabble bag and laying them out on their rack, the first player must use a sufficient number to make a complete word to get the game going. There can be a lot riding on this initial play. So, it’s not an uncommon practice for participants to take a little time moving the letters around to see what arrangement will give them the highest score. After all, if they can keep their early advantage, they may eventually win the game!

What’s more, as the game progresses, players will sometimes become stumped about how to display the tiles that they have on the board to gain the most points for the play. In short, having an anagram creator can assist Scrabble players to use their tile points to make words with the best possible score quickly so that the game remains exciting.

Words with Friends Anagram Finder

Similarly, an anagram word finder can be an invaluable device when enjoying Words with Friends. Faced with a jumble of letters, some players may be tempted to cheat or may try out words that they’re not very sure of. Would you believe that the English language has over 171,400 words? In addition, new words are added all the time. Therefore, it’s no wonder that game participants will sometimes become confused or perplexed when they’re attempting to solve multiple words and figure out where to make their next move.

Since Words with Friends is a digital game, you may be engaging with people anywhere in the world unless, of course, you choose to play solo. The game has the potential to be quite fast-paced, and you certainly don’t want to contemplate over your next move to slow things down ─ particularly when you may just be getting to know your opponent! This is where having a word anagram aid to use can be indispensable.

2 Tips to Solve Anagrams for Word Games Players

Are you ready for some final tips about solving anagrams? We’re sure that you can put the following information to good use!

Tip 1: Word Unscrambler 

By employing Word Unscrambler, participants in word games are able to search for anagrams by entering the letters and wildcards that they have. Not only that, but they can use an advanced filter to discover words that start or end with particular letters and for other inquiries.

Here are a few examples:

The word “listen” is made up of letters EILNTS. When the word itself if entered in the Word Unscrambler, it quickly finds “silent”.

Along the same lines, “save”, comprised of AESV, reveals the word “vase” in the Word Unscrambler.

Tip 2: Phrase Unscrambler 

When we study a phrase on its own, we can become quite stuck on its meaning and it can be difficult to see just how the words and letters can make something new. Hence, Phrase Unscrambler can be very valuable when players are looking to change the letters around in phrases to pinpoint anagrams. 

Take a look at these examples:

“Dirty room” contains the following letters ─ DIMOORRTY. Putting the phrase into the Phrase Unscrambler uncovers the word “dormitory”.

By entering the phrase “moon starer” that has these letters ─ AEMNOORRST, the Phrase Unscrambler locates the word “Astronomer”.

Start playing with our anagram finder and discover the surprising number of options just a single collection of tiles can yield. Become an anagram creator today!

dCode

Search for a tool

Word Mixer

Tools for mixing words (names, first names, etc.). The word mixer makes new or existing words (suitcase words, longest word, anagrams, etc.)

Results

Word Mixer

Tag(s) : Fun/Miscellaneous, Word Games

Share

Share

dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!

  1. Fun/Miscellaneous
  2. Word Mixer

Word/Name Mixer

Answers to Questions (FAQ)

How to mix word or names? (Definition)

There are several ways to mix words (or more precisely from words’ letters).

Generating a contraction word (portmanteau)

Two words can be contracted/fused into one (which exists or not)

Example: BRITAIN+EXIT=BREXIT

This method is popular on social networks to fusion two words and create hashtags

Generating an anagram

Letters can be mixed/scrambled and swapped together to get 1 or more words (but sometimes none exists in the dictionary).

Example: DOG <=> GOD

This method can also generate pseudonyms.

Example: SALVADOR DALI <=> AVIDA DOLLARS

Combining only some letters

It is sometimes impossible to generate anagrams but using some of the letters may be enough (similar to the longest word problem).

Example: The letters TWO+WORDS can create the words ROOT, DOTS, etc.

This also works with first names:

Example: TWO+FIRSTNAMES can give SIMONETTA, RAMSES, STEFANO, etc.

Why mixing word or names?

Mixing words makes it possible to create new concepts, the generator/mixer brings new ideas combining words, surnames or first names that have a meaning, both in the mechanics of mixing/combining and in the result (the generated word can / must remain comprehensible)

How to shuffle letters in a word?

Source code

dCode retains ownership of the «Word Mixer» source code. Except explicit open source licence (indicated Creative Commons / free), the «Word Mixer» algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or the «Word Mixer» functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for «Word Mixer» are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.

Cite dCode

The copy-paste of the page «Word Mixer» or any of its results, is allowed as long as you cite dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Word Mixer on dCode.fr [online website], retrieved on 2023-04-14, https://www.dcode.fr/words-mixer

French (Français) Spanish (Español)

Summary

https://www.dcode.fr/words-mixer

© 2023 dCode — The ultimate ‘toolkit’ to solve every games / riddles / geocaching / CTF.

 

This class was created by Brainscape user Mojtaba sh.
Visit their profile to learn more about the creator.



  • decks


  • flashcards


  • learners

Deck in this class (1)

Making Word

No deck description has yet been added by the author.

26
 cards

More about

Making One Word From Another

  • Class purpose
    General learning

This pack was created from the iOS Brainscape App

How studying
works.

Brainscape’s adaptive web mobile flashcards system will drill you on your weaknesses, using a pattern guaranteed to help you learn more in less time.

Add your own
flashcards.

Either request «Edit» access from the author, or make a copy of the class to edit as your own.
And you can always create a totally new class of your own too!

What’s Brainscape anyway?

Brainscape is a digital flashcards platform where you can find, create, share, and study any subject on the planet.

We use an adaptive study algorithm that is proven to help you learn faster and remember longer.

Looking for something else?

European History 101

  • 19
    decks

  • 661
    flashcards

  • 7,091
    learners

Decks:
The Late Middle Ages, The Renaissance, The Age Of Exploration, And more!

***2021 monthly words

  • 34
    decks

  • 7013
    flashcards

  • 1
    learners

Decks:
Muhammad Words Up Until 30 Aug 2021, Montasser Words Part 1, Dalia Words Up Until 30 Aug 2021 Part 1, And more!

WSET D3 from Henry P

  • 112
    decks

  • 3009
    flashcards

  • 24
    learners

Decks:
Bordeaux Left Bank, 1 Bordeaux General, Bordeaux The Right Bank, And more!

  • AI Image Generator — Type what you want to see and it appears.
  • AI Rap Battles — Eminem vs Jay-Z, Elon Musk vs Mark Zuckerberg, Jimmy Fallon vs Jimmy Kimmel, and more.
  • AI Article Writer — Our AI will write an article for you.
  • Lyrics Generator — Our AI writes hit songs.
  • Fake People — AI-generated faces.
  • Falling Sand — Play with lava, water, napalm and more.
  • Dating Simulator — A game where you go on dates with a virtual girl or guy.
  • Insult Battle — We dare you to insult our AI.
  • Joke Battle — Can you tell a better joke than our AI?
  • TV Episode Generator — The Simpsons, Friends, Game of Thrones and more.
  • Celeb Lookalike — Which celebrity do you look like? Upload your photo.
  • Celebrity AI Chat — Talk with Elon Musk, Billie Eilish, Jimmy Fallon, Homer Simpson, and others.
  • AI Farts — What do robot farts sound like?
  • Quote Generator — AI thoughts to inspire you.
  • This Pizza Does Not Exist — Generated by a computer.
  • AI-Generated Podcasts — A podcast 100% written and voiced by an AI.
  • Text Adventure Game — Interactive fiction powered by AI.
  • Video Game Ideas — Our AI thinks up new games.
  • Haiku — Our AI writes short Japanese poems.
  • Movie Plot Generator — Movies that do not exist.
  • AI Music — Listen to songs our AI created
  • Heavy Metal Lyrics Generator — Our AI rocks!
  • Deepfake Videos — Elon Musk in Reefer Madness, Joe Exotic — Lost Movie Footage, and Logan Paul — Tiger King.
  • Marriage Simulator — Powered by AI.
  • AI Art Database — View millions of images created by AI.
  • Academic Paper Generator — The AI writes scientific papers (like on arXiv.org).
  • Anime Stories — Read an AI-generated anime story.
  • Poetry Generator — Our AI is a poet.
  • Photo Blender — Two beautiful photos combined into one.
  • Happy Moments — What makes humans happy?
  • New Words — These words do not exist.
  • Life Simulator Game — Set in a cold and unforgiving cyberpunk world where anything is possible.
  • AI Dreams — What does a computer dream?
  • Band Name Generator — Hundreds of fun band names.
  • Movie Montage Maker — Type a word or phrase, see a video montage.
  • Anagram Generator — Words formed by rearranging the letters.
  • Wrestling Match — An AI-generated wrestling simulation.
  • Business Ideas — Our AI will help you make money.
  • Meme Generator — Memes written by an AI.
  • BoredHumans Apes — Apes that do not exist.
  • Story Generator — Our AI will tell you a story.
  • Baby Name Generator — Unique baby names.
  • Fortune Cookies — Our AI knows your future.
  • Get Yelled At — Our AI will get mad at you.
  • Waifu Images — These anime characters do not really exist.
  • Invention Generator — Ideas for new products.
  • Fake Dogs — AI-generated dogs.
  • Neural Style Transfer — Turn a photo into a painting, like Picasso or VanGogh.
  • Superhero Name Generator — Find your superhero name.
  • Face Animation — Upload a photo of your face and our AI will make it move.
  • Confessions — Our AI has secrets.
  • Writing Prompts — Our AI starts the story, you finish it.
  • NFT Search Engine — Searches millions of NFTs on 10 blockchains all at once.
  • Domain Name Appraisals — Curious what a domain name is worth? Instantly find out the value using AI.
  • Hair Style Changer — Upload your photo to see what you look like in different hair colors and styles.
  • Age Progression — Upload your photo and see what you will look like when you get older.
  • Cartoonify Yourself — Upload your photo and turn your face into a cartoon.
  • AI Transcription — Our speech-to-text technology turns your audio file into words.
  • Video Articles — Brought to life by AI.
  • ML Datasets — We created a search engine of over 100,000 free machine learning datasets for training AI models.
  • AI Games — Pong, Slime Volleyball, and more.
  • AI Demos — See how machine learning and genetic algorithms work.
  • Text-To-Speech (TTS) — Type something and our AI will speak it.
  • Image Captioning — Upload a photo and see what our AI thinks the scene is.
  • Object Detection — Upload a photo and see what objects our AI detects.
  • Super Resolution — Improve the resolution of a photo by up to 4x.
  • Image Background Removal — Works in seconds for jpg and png images.
  • Logo Maker — Create a free logo using AI.
  • Chat Bot — Talk with our AI about anything you want.
  • Travel Guide — Our AI will tell you the best things to do at any location.
  • Text Summarization Tool — Our AI will create a summary of any article, paper, or document.
  • Text Paraphrasing Tool — Use AI to paraphrase your words.
  • Grammar Checker Tool — AI will fix any problems with your text.
  • Text Improvement Tool — Use AI to improve the fluency, clarity, and vocabulary of your writing.
  • Tarot Card Readings — Find out your future using AI.
  • Virtual Pets — Adopt a free virtual dog, cat, parrot, platypus, kangaroo, pig, turtle, koala bear, monkey, or horse.
  • Sketch Game — Draw something and our AI will guess what it is.
  • Website Builder — AI will build a website for you. Just type what you want.

  • Coming Soon — BoredGPT — Like ChatGPT, but more acurate and more powerful.
  • Coming Soon — Image Editor — Edit photos and images just by telling the AI what you want to change.
  • Coming Soon — Interior Design — See what a room would look like in different design styles.
  • Coming Soon — Dystopia — A dystopian world powered by ChatGPT.
  • Coming Soon — Rock Paper Scissors — Use the camera on your phone or PC to play against the AI.
  • Coming Soon — AI Video Generator — Type what you want to see.
  • Coming Soon — Image Chat — Upload an image and ask it questions.
  • Coming Soon — AI Stock Market Predictions — We use machine learning to predict the prices of stocks and crypto coins.
  • Coming Soon — Guess the Jellybeans — Can you guess better than our AI how many jelly beans are in the jar?

Instead of turning the dictionary into a full graph, use something with a little less structure:

For each word in the dictionary, you get a shortened_word by deleting character number i for each i in len(word). Map the pair (shortened_word, i) to a list of all the words.

This helps looking up all words with one replaced letter (because they must be in the same (shortened_word, i) bin for some i, and words with one more letter (because they must be in some (word, i) bin for some i.

The Python code:

from collections import defaultdict, deque
from itertools import chain

def shortened_words(word):
    for i in range(len(word)):
        yield word[:i] + word[i + 1:], i


def prepare_graph(d):
    g = defaultdict(list)
    for word in d:
        for short in shortened_words(word):
            g[short].append(word)
    return g


def walk_graph(g, d, start, end):
    todo = deque([start])
    seen = {start: None}
    while todo:
        word = todo.popleft()
        if word == end: # end is reachable
            break

        same_length = chain(*(g[short] for short in shortened_words(word)))
        one_longer = chain(*(g[word, i] for i in range(len(word) + 1)))
        one_shorter = (w for w, i in shortened_words(word) if w in d)
        for next_word in chain(same_length, one_longer, one_shorter):
            if next_word not in seen:
                seen[next_word] = word
                todo.append(next_word)
    else: # no break, i.e. not reachable
        return None # not reachable

    path = [end]
    while path[-1] != start:
        path.append(seen[path[-1]])
    return path[::-1]

And the usage:

dictionary = ispell_dict # list of 47158 words

graph = prepare_graph(dictionary)
print(" -> ".join(walk_graph(graph, dictionary, "hands", "feet")))
print(" -> ".join(walk_graph(graph, dictionary, "brain", "game")))

Output:

hands -> bands -> bends -> bents -> beets -> beet -> feet
brain -> drain -> drawn -> dawn -> damn -> dame -> game

A word about speed: building the ‘graph helper’ is fast (1 second), but hands -> feet takes 14 seconds, and brain —> game takes 7 seconds.

Edit: If you need more speed, you can try using a graph or network library. Or you actually build the full graph (slow) and then find paths much faster. This mostly consists of moving the look-up of edges from the walking function to the graph-building function:

def prepare_graph(d):
    g = defaultdict(list)
    for word in d:
        for short in shortened_words(word):
            g[short].append(word)

    next_words = {}
    for word in d:
        same_length = chain(*(g[short] for short in shortened_words(word)))
        one_longer = chain(*(g[word, i] for i in range(len(word) + 1)))
        one_shorter = (w for w, i in shortened_words(word) if w in d)
        next_words[word] = set(chain(same_length, one_longer, one_shorter))
        next_words[word].remove(word)

    return next_words


def walk_graph(g, start, end):
    todo = deque([start])
    seen = {start: None}
    while todo:
        word = todo.popleft()
        if word == end: # end is reachable
            break

        for next_word in g[word]:
            if next_word not in seen:
                seen[next_word] = word
                todo.append(next_word)
    else: # no break, i.e. not reachable
        return None # not reachable

    path = [end]
    while path[-1] != start:
        path.append(seen[path[-1]])
    return path[::-1]

Usage: Build the graph first (slow, all timings on some i5 laptop, YMMV).

dictionary = ispell_dict # list of 47158 words
graph = prepare_graph(dictionary)  # more than 6 minutes!

Now find the paths (much faster than before, times without printing):

print(" -> ".join(walk_graph(graph, "hands", "feet")))          # 10 ms
print(" -> ".join(walk_graph(graph, "brain", "game")))          #  6 ms
print(" -> ".join(walk_graph(graph, "tampering", "crunchier"))) # 25 ms

Output:

hands -> lands -> lends -> lens -> lees -> fees -> feet
brain -> drain -> drawn -> dawn -> damn -> dame -> game
tampering -> tapering -> capering -> catering -> watering -> wavering -> havering -> hovering -> lovering -> levering -> leering -> peering -> peeping -> seeping -> seeing -> sewing -> swing -> swings -> sings -> sines -> pines -> panes -> paces -> peaces -> peaches -> beaches -> benches -> bunches -> brunches -> crunches -> cruncher -> crunchier

Понравилась статья? Поделить с друзьями:
  • Make sentence with word circle
  • Make numbered list in word
  • Make sentence with word came
  • Make number line in word
  • Make notes on word document