MCPcopy Index your code
hub / github.com/pytorch/tutorials / loadPrepareData

Function loadPrepareData

beginner_source/chatbot_tutorial.py:368–379  ·  view source on GitHub ↗
(corpus, corpus_name, datafile, save_dir)

Source from the content-addressed store, hash-verified

366
367# Using the functions defined above, return a populated voc object and pairs list
368def 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

Callers 1

Calls 3

readVocsFunction · 0.85
filterPairsFunction · 0.70
addSentenceMethod · 0.45

Tested by

no test coverage detected