Checking to see how many words can be made from one word

Hi Folks,

I have an array of words with around 20000 words or so in it. Basically I want to be able to send a word or more than likely a random set of letters to it to see how many words can be made from them e.g. if i send the word ‘therefore’ all the following would be returned as viable options i.e.
eh
err
ether
fee
feet
ferret
foe
for
fore
fort
forte
forth
free
freer
fret
fro
frore
froth
frother
he
hefter
her
here
hereof
hereto
hero
het
hoe
hoer
hot
of
oft
oh
or
ore
other
re
reef
ref
refer
retree
retro
rho
roe
rot
rote
tee
the
thee
there
therefor
therefore
thereof
three
throe
to
toe
tore
tree

Any ideas as to how I would implement this in blueprints.

Thanks for any help

I do not think this is something you can do in blueprints, this stuff need some crazy indexing.

I thought it might be problematic, I have managed quite a bit with words/strings in blueprints but this has me stumped

You can do something like that in blueprints ofc but unless you get really really clever with it somehow then you will basically have to do a bunch of for-loops on that array.

For example… for the word ‘therefore’ you would do a for-loop for each chunk of the word and see if each array string contains that chunk of the word.

So… first loop you check ‘th’, second loop you check ‘the’, third loop ‘ther’… 863264 (:p) loop you check “ore” … you get the idea hopefully xD

Edit:
Or rather you can create a small array with all the “chunks” of the original word and then loop through the large word array once and check if each string contains any of the strings from the “chunks array”.
There are multiple ways you could go about this I suppose.

I’ve been trying something using breaking down the ‘word’ to be checked into a character array then trying to compare it to the letters that make up the words in the dictionary, but I’m not getting anywhere with it

You could “bruteforce” this. Search for “word permutations algorithm”.
When you have permutation working, you need to check for each if its in word database, then count them.
This is quite slow way.

Other clever way is to index characters in all dictionary words.
And check if your random word has at least same or more characters.
Ie all words with less or equal number of A, then b then c and so on.
This is also quite slow, but at least linear solution.

getting list of alphabet characters sorted by probability of being used by english word can speed things up.
When you have that list you should compare words from last probable character of random word.
Because imo you get much more misses here than hits while checking.