(encoder, decoder, searcher, voc)
| 1200 | |
| 1201 | |
| 1202 | def evaluateInput(encoder, decoder, searcher, voc): |
| 1203 | input_sentence = '' |
| 1204 | while(1): |
| 1205 | try: |
| 1206 | # Get input sentence |
| 1207 | input_sentence = input('> ') |
| 1208 | # Check if it is quit case |
| 1209 | if input_sentence == 'q' or input_sentence == 'quit': break |
| 1210 | # Normalize sentence |
| 1211 | input_sentence = normalizeString(input_sentence) |
| 1212 | # Evaluate sentence |
| 1213 | output_words = evaluate(encoder, decoder, searcher, voc, input_sentence) |
| 1214 | # Format and print response sentence |
| 1215 | output_words[:] = [x for x in output_words if not (x == 'EOS' or x == 'PAD')] |
| 1216 | print('Bot:', ' '.join(output_words)) |
| 1217 | |
| 1218 | except KeyError: |
| 1219 | print("Error: Encountered unknown word.") |
| 1220 | |
| 1221 | |
| 1222 | ###################################################################### |
nothing calls this directly
no test coverage detected