from morse_decrypt.dict import Dict class WordGuess: def __init__(self, dictionary: Dict): self.dictionary = dictionary def guess_vocabs(self, word: str, phrase="", vocab_guesses=None): if word == "": vocab_guesses.append(phrase) else: for vocab in self.dictionary: if vocab == word[0:len(vocab)]: self.guess_vocabs(word[len(vocab):len(word)], (phrase + vocab + " "), vocab_guesses) return vocab_guesses