Jump to content
Server Maintenance This Week. ×

Help needed with progressive/branching anagrams


Hawkeye1976

This topic is 3515 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi folks,

 

I'm currently trying to turn a list of words into a progressive anagram tree, but I can't find a working way to solve that issue.

Here's what I need to do:
A list of words like this
 

baseball
football
basketball
hockey
olympics
nascar
redistribution
 
must be turned into a branching anagram like:

A
   i
      - hockey
 
   r
      - olympics
 
   - redistribution
 
L
   - nascar
 
E
   - football
 
K
   - baseball
 
- basketball
 
What would be the easiest way to establish that in FM?
Really hope, that somebody can help me out ...

 

Link to comment
Share on other sites

I believe (after a brief googling) that this has nothing to do with anagrams, but rather with so called "progressive anagrams" that are used by magicians or mentalists.

 

But it seems to me that the order of the actions here is wrong: you cannot start with an arbitrary list of words, because if any pair of words in the list happen to be a (real) anagram of each other, then no result can be reached.

Link to comment
Share on other sites

I believe (after a brief googling) that this has nothing to do with anagrams, but rather with so called "progressive anagrams" that are used by magicians or mentalists.

 

Indeed; alas, on my sojourns to a few message boards I found nothing tangible, i.e. an algorithm; when people (sort of) asked for it, they were referred to other sites/applications or promised responses via PM.

 

A Wikipedia search for “progressive a.” or “branching a.” in Wikipedia didn't produce anything remotely related, which I find quite unusual …

 

One can produce the (first level of) the sample result by working with the letters come from a given word/phrase (“ALEK”, in this case). Put each word from the list into a bin for the first letter in the phrase that does not appear in it, and combine all bins into the final result (including a bin for words that have all letters).

 

post-80889-0-32994200-1410377779_thumb.p

 

Then (I think) repeat with all bins that have more than one result to produce the next level  … but using what letters now?

Link to comment
Share on other sites

Comment is right. Branching anagrams are used by magicians and I normally build them by hand, but want to automate the process.

Currently I'm trying to establish that with two related tables. The first one - at this stage - holds an ID, a global field for entering the words  and a portal that shows the words. If a word is entered in the global field, a related record is created in the second table.
In the second table there are five fields right now: one for the word, a calculated field that strips the word down to the letters it contains like:
baseball -> abels 
a field for the level and of course an ID-field and the key-field which holds the anagram-id from the first table to relate them.

Now a script has to do the following:
Put all the letter-fields into a list and via pattern-count find the most frequent letter in that list to get the first "station" of the branch.
Then find the most frequent letter in the remainder and so on. I already achieved that with a script that returns the phrase for the first level.
But I have a problem with creating a script/loop, that calculates that further and creates the final list.

Link to comment
Share on other sites

Keep in mind that I haven't even heard of this "trick" until a few hours ago. Still, it seems to me that the process needs to start with a (large) database of words. Once you have that, you can you enter a keyword (a sequence of unique letters) for which you want to create the progressive anagram. Next, the solution should present you with several groups of words to choose from:

 

• the first group contains the words that do not contain any of the keyword letters;

• the second group contains the words that contain (only) the first of the keyword letters;

• the third group contains the words that contain (only) the first and the second one of the keyword letters; and so on.

 

You select one word out of each group and that should be it. Note that there will be no "branching" in this process.

 

 

As I said earlier, I don't see how the algorithm you describe is going to work with arbitrarily chosen words.

Link to comment
Share on other sites

I think, you got me wrong. There's no need for a large database of words, because normally in magic before the anagram-thing happens, you have eliminated many words and only use a small group ... like zodiac signs for example. There is no need to find those branches by a key-phrase.

You have to think of the branching as a yes/no-answering-process. Each "No" will lead to the next branch. Maybe I have to create the loop in a fashion that it stops after x No-responses in a row. 

 

Link to comment
Share on other sites

And what guarantees that a "logical group" does not contain any anagrams?

 

Anyway, suppose that it doesn't.  I think the problem here is that you are asking how to automate something, and I don't understand what that something is. We need to work out a simple example "on paper" first.  What would be the steps considering this group of words:

 

- abc

- abd

- abe

- xyz

Link to comment
Share on other sites

Okay, here's what I would do "on paper":

1. remove duplicate letters from the words and bring them in alphabetical order:

-abc
-abd
-abe
-xyz

(okay, in this case not needed)

2. find the most frequent letter. In this case a or b both occur 3 times, so a would be the choice, because it's the closest to the beginning of the alphabet. So "A" would be the first "question and responded with "no" it would leave:

A
    - xyz

Because it leaves only one word "xyz", there's no need to process this branch further.

3. Now 2 is repeated with the remaining words:

-abc
-abd
-abe

Again, a & b are the most frequent, but because "A" was already used, we go with "B", but that wouldn't branch the words. So we would go for c, d, or e:

C
    - abd
    - abe

this has to be branched deeper:

C

     d
         - abe
     - abd

 

Now the tree looks like this:

 

A
    - xyz

 

C

     d
         - abe
     - abd

 

-abc

Hope, that makes the principle clear.



 

Link to comment
Share on other sites

Well, that's a start, but you didn't do this part on paper - you did it in your head:

 

we go with "B", but that wouldn't branch the words.

 

So it seems that when you select a letter, you need to test that there is at least one (remaining) word that doesn't contain that letter. And if there are two or more such words, you need to branch.

Link to comment
Share on other sites

Well, that's a start, but you didn't do this part on paper - you did it in your head:

 

 

So it seems that when you select a letter, you need to test that there is at least one (remaining) word that doesn't contain that letter. And if there are two or more such words, you need to branch.

Exactly.

Link to comment
Share on other sites

I  wonder why you wouldn't prefer to do this in the opposite order:

 

Starting with:

- abc
- abd
- abe
- xyw
- xyz

 

1. Letters used only once: CDEWZ. Select the first one of these:

 

C identifies/eliminates "abc". If the answer is no, then the remaining words are:

- abd
- abe
- xyw
- xyz

 

2. Letters used only once: DEWZ. Select the first one of these:

 

D identifies/eliminates "abd". If the answer is no, then the remaining words are:

- abe
- xyw
- xyz

 

3. Letters used only once: EWZ. Select the first one of these:

 

E identifies/eliminates "abe". If the answer is no, then the remaining words are:

- xyw
- xyz

 

4. Letters used only once: WZ. Select the first one of these, and you are done in 4 iterations, with no branching required.

 

 

---

I'll have to test an example where there aren't any letters used only once.

Edited by comment
Link to comment
Share on other sites

Thank you, that's it!

 

Well, I am sure there's some room for improvements.

 

One thing I would look into is omitting previously used letters from the list (and resetting i to 1 at the beginning of the loop). I suspect the way it is now may produce incorrect results in some cases.

Link to comment
Share on other sites

This topic is 3515 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.