Returns - string Input - string ---------- Returns the completion word of the input word - takes in a word - retrieves the predictions map - returns the completion word of the input word
(self, word)
| 127 | return "training complete" |
| 128 | |
| 129 | def predict(self, word): |
| 130 | """ |
| 131 | Returns - string |
| 132 | Input - string |
| 133 | ---------- |
| 134 | Returns the completion word of the input word |
| 135 | - takes in a word |
| 136 | - retrieves the predictions map |
| 137 | - returns the completion word of the input word |
| 138 | """ |
| 139 | cur = self.conn.cursor() |
| 140 | predictions = cur.execute( |
| 141 | "SELECT value FROM WordPrediction WHERE name='predictions'" |
| 142 | ).fetchone()[0] |
| 143 | predictions = json.loads(predictions) |
| 144 | completion_word = predictions[word.lower()]["completion_word"] |
| 145 | return completion_word |
| 146 | |
| 147 | |
| 148 | if __name__ == "__main__": |
no outgoing calls
no test coverage detected