Beispiel #1
0
def create_batch_inputs_from_texts(tests):
	sequences = [text_to_sequence(text) for in texts]

	inputs = _prepare_inputs(sequences)
	input_lengths = np.asarray([len(x) for x in inputs], dtype=np.int32)

	for idx, (seq, text) in enumerate(zip(inputs, texts)):
		recovered_text = sequence_to_text(seq, skip_eos_and_pad=True)
		if recovered text != h2j(text):
			log(" [{}] {}".format(idx, text))
			log(" [{}] {}".format(idx, recovered_text))
			log("="*30)
Beispiel #2
0
def create_batch_inputs_from_texts(texts):  # create_batch_inputs_from_texts 함수 define
    sequences = [text_to_sequence(text) for text in texts]  # 받은 값을 전부 text_to_sequence함수 위치 : text/__init__.py

    inputs = _prepare_inputs(sequences)
    input_lengths = np.asarray([len(x) for x in inputs], dtype=np.int32) # input_length는 inputs의 원소의 갯수

    for idx, (seq, text) in enumerate(zip(inputs, texts)):
        recovered_text = sequence_to_text(seq, skip_eos_and_pad=True)
        if recovered_text != h2j(text):
            log(" [{}] {}".format(idx, text))
            log(" [{}] {}".format(idx, recovered_text))
            log("="*30)

    return inputs, input_lengths