def analize(text): # valid command list commandset = commands.givecommands() sounder = Sounder(commandset) index = sounder.search(text.lower().split()) command = " ".join(commandset[index]) return command
key_words_array = [] for a in dataset: key_words_array.append(a[1]) s = Sounder(key_words_array) def get_user_words_array(user_string): user_array = user_string.split() for user_word in user_array: if user_word in s.get_reserved_sub_words(): user_array.remove(user_word) return user_array user_keywords = get_user_words_array(user_string) print("\n") index = s.search(user_keywords) print("Intent Predicted: %s" % dataset[index]) print("\n") status = s.probability(user_keywords, prediction=True) print("Status Report: %s" % status) # https://goo.gl/HZfTWF print("\n")