(corpus, corpus_name, datafile, save_dir)
| 366 | |
| 367 | # Using the functions defined above, return a populated voc object and pairs list |
| 368 | def loadPrepareData(corpus, corpus_name, datafile, save_dir): |
| 369 | print("Start preparing training data ...") |
| 370 | voc, pairs = readVocs(datafile, corpus_name) |
| 371 | print("Read {!s} sentence pairs".format(len(pairs))) |
| 372 | pairs = filterPairs(pairs) |
| 373 | print("Trimmed to {!s} sentence pairs".format(len(pairs))) |
| 374 | print("Counting words...") |
| 375 | for pair in pairs: |
| 376 | voc.addSentence(pair[0]) |
| 377 | voc.addSentence(pair[1]) |
| 378 | print("Counted words:", voc.num_words) |
| 379 | return voc, pairs |
| 380 | |
| 381 | |
| 382 | # Load/Assemble voc and pairs |
no test coverage detected