MCPcopy Create free account
hub / github.com/chinawithfrank/ChatBotCourse / get_train_set

Function get_train_set

chatbotv5/demo.py:47–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45
46
47def get_train_set():
48 global num_encoder_symbols, num_decoder_symbols
49 train_set = []
50 with open('./samples/question', 'r') as question_file:
51 with open('./samples/answer', 'r') as answer_file:
52 while True:
53 question = question_file.readline()
54 answer = answer_file.readline()
55 if question and answer:
56 question = question.strip()
57 answer = answer.strip()
58
59 question_id_list = get_id_list_from(question)
60 answer_id_list = get_id_list_from(answer)
61 if len(question_id_list) > 0 and len(answer_id_list) > 0:
62 answer_id_list.append(EOS_ID)
63 train_set.append([question_id_list, answer_id_list])
64 else:
65 break
66 return train_set
67
68
69def get_samples(train_set, batch_num):

Callers 1

trainFunction · 0.85

Calls 2

get_id_list_fromFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected