In: Morse-Chiffre Out: Gültige Buchstabenkombinationen ("words"), Wortkombinationen aus natürlichen Sprachen ("phrases")
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

15 lines
507 B

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