# Machine learning algorithms for correct words formation from jumbled words

https://www.google.com/search?q=jumbled+words&oq=jumbled&aqs=chrome.1.69i57j0l4.3399j0j9&client=ms-android-lava&sourceid=chrome-mobile&ie=UTF-8

Can Machine learning algorithms solve the input dataset of jumbled words and form the correct words from them?

• do you want to correct jumbled words or jumbled sentences or both? – Madhur Yadav Sep 14 '20 at 16:05
• Thanks Madhur. Only Jumbled words. Example : Input Jumbled Word : OXB. Output : BOX – Prashant Akerkar Sep 14 '20 at 16:20

## 1 Answer

from itertools import permutations
import string
permutation_list = []
s = "BOX"
a = string.ascii_letters
p = permutations(s)

# Create a dictionary
d = []
for i in list(p):

# Print only if not in dictionary
if (i not in d):
d.append(i)
permutation_list.append(''.join(i))
print(''.join(i))

import nltk
nltk.download('words')

from nltk.corpus import words
for word in permutation_list:
print(word.lower() in words.words())

output -
BOX True
BXO False
OBX False
OXB False
XBO False
XOB False

• you can add custom words in a file,read it and extend the words.words (list type) to get a match of custom words. – Madhur Yadav Sep 14 '20 at 17:05
• Thanks Madhur. One Jumbled word can have multiple meaningful words. Can the algorithm work for the same given below? Jumbled word example : LOWF Correct words : FLOW, WOLF, FOWL. Also Can the algorithm work for a long word (many many characters) ? – Prashant Akerkar Sep 14 '20 at 18:43
• if you ask a person that what is the correct word for LOWF, even the person would guess it wrong. It's difficult to solve ambiguity. You could check the part of speech, noun, verb, etc and select the desired output. This code would work fine for words with multiple words and repeated characters. – Madhur Yadav Sep 14 '20 at 18:49
• Thanks Madhur. Can there be any limitations to these code after rigorous testing of inputting english words where the word string length is long? google.com/… Note : The word is in the english dictionary, but is long in string length. – Prashant Akerkar Sep 14 '20 at 18:53
• you can use generators instead of lists for faster execution, you can use specific models if you are looking for a specific genre of words, eg - scispacy nlp model for scientific words. also you can hit some apis of anagram webapps and get the output anagrammer.com/anagrams-of/nlp – Madhur Yadav Sep 14 '20 at 19:02