1
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ do you want to correct jumbled words or jumbled sentences or both? $\endgroup$ Sep 14, 2020 at 16:05
  • $\begingroup$ Thanks Madhur. Only Jumbled words. Example : Input Jumbled Word : OXB. Output : BOX $\endgroup$ Sep 14, 2020 at 16:20

1 Answer 1

1
$\begingroup$
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
$\endgroup$
10
  • $\begingroup$ you can add custom words in a file,read it and extend the words.words (list type) to get a match of custom words. $\endgroup$ Sep 14, 2020 at 17:05
  • 1
    $\begingroup$ 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. $\endgroup$ Sep 14, 2020 at 18:49
  • 1
    $\begingroup$ 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 $\endgroup$ Sep 14, 2020 at 19:02
  • 1
    $\begingroup$ Please upvote my answer if you think it helped you in solving the problem statement $\endgroup$ Sep 14, 2020 at 19:02
  • 1
    $\begingroup$ It can work on above languages , you can have to load nlp models of these languages, try spacy language models $\endgroup$ Sep 15, 2020 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.