I was redirected from StackOverflow to your community in hope to get some help and improve my script.
The script receives letters as input and generates possible words, then extracts readable words from comparing my list items with file containing English words.
For example when I enter as input :
this will generate a list like:
["esy", "eys", "sey", "sye", "yes", "yse"]
and return the correct readable word "yes" as a final result.
The problem is when the length of input is greater than 8 characters it takes much time and I want to use Threading or Multiprocessing to reduce the latency.
'''Create script that generate readable english words from given letters''' from math import factorial from itertools import permutations from time import time, ctime from threading import Thread import multiprocessing as mp class GetReadableWords: def __init__(self, letters): self.letters = letters def prob_words(self): self.comb = factorial(len(self.letters)) print('Nomber of combinitions that we have is : ', self.comb) self.prob = [''.join(ltr) for ltr in permutations(self.letters)] return self.prob def chek_word(self): result =  for word in set(self.prob_words()): with open('corncob_lowercase.txt', 'r') as f: for line in f.readlines(): line = line.rstrip() if word == line: result.append(word) else: continue f.close() return result '''def run(self): with mp.Pool() as pool: pool.map(self.chek_word(), self.prob, chunksize=1)''' if __name__ == "__main__": user_input = input('Enter your random characters : ') sart_time = time() print("starting time at : ", ctime(sart_time).split(' ')) c = GetReadableWords(user_input) ''' threads =  for word in c.prob_words(): p = mp.Process(target=c.chek_word(), args=(word,)) threads.append(p) p.start() for job in jobs: job.join() ''' #print(c.run()) print(c.chek_word()) end_time = time() print("ending time at : ", ctime(end_time).split(' ')) elaps_t = (end_time - sart_time) print("time taken is : %.2f sec" % elaps_t)