(word)
| 37 | |
| 38 | |
| 39 | def translate(word): |
| 40 | word = word.lower() |
| 41 | if word in data: |
| 42 | speak("Here is what I found in dictionary..") |
| 43 | d = data[word] |
| 44 | d = "".join(str(e) for e in d) |
| 45 | speak(d) |
| 46 | elif len(get_close_matches(word, data.keys())) > 0: |
| 47 | x = get_close_matches(word, data.keys())[0] |
| 48 | speak("Did you mean " + x + " instead, respond with Yes or No.") |
| 49 | ans = takeCommand().lower() |
| 50 | if "yes" in ans: |
| 51 | speak("ok " + "It means.." + data[x]) |
| 52 | elif "no" in ans: |
| 53 | speak("Word doesn't exist. Please make sure you spelled it correctly.") |
| 54 | else: |
| 55 | speak("We didn't understand your entry.") |
| 56 | |
| 57 | else: |
| 58 | speak("Word doesn't exist. Please double check it.") |
| 59 | |
| 60 | |
| 61 | if __name__ == "__main__": |
no test coverage detected