def nodeDataConsistentWithRawMorse(self, data): translatedData = encodeMorse(data, is_compact=True) # 0 is the first index position; ie, find our translation # string is in the raw morse and it matches at position zero if self.raw_morse.find(translatedData) == 0: return True return False
def getPossibleNextChars(self, string_so_far): # mHash is the hash of alpha to morse mHash = getHash() morse_so_far = encodeMorse(string_so_far, is_compact=True) return_list = [] # get the string portion from current index on to end of string inspect_string = self.raw_morse[len(morse_so_far):] for alpha in mHash: # if this morse letter is at the beginning of the string... if inspect_string.find(mHash[alpha]) == 0: return_list.append(alpha) return return_list
def nodeDataMatchesRawMorse(self, data): encoded_morse = encodeMorse(data, is_compact=True) if encoded_morse == self.raw_morse: return True return False