import tensorflow as tf import numpy as np import tool as tool import time # data loading data_path = './newscorpus.csv' title, contents = tool.loading_data(data_path, eng=False, num=False, punc=False) test_title, test_content = tool.loading_data("sample.csv", eng=False, num=False, punc=False) for i in range(len(test_title)): test_title[i] = "" word_to_ix, ix_to_word = tool.make_dict_all_cut(title + contents + test_content, minlength=0, maxlength=3, jamo_delete=True) # parameters multi = True forward_only = False hidden_size = 300 vocab_size = len(ix_to_word) num_layers = 3 learning_rate = 0.001 batch_size = 16 encoder_size = 100 decoder_size = tool.check_doclength(title, sep=True) # (Maximum) number of time steps in this batch steps_per_checkpoint = 20 # transform data encoderinputs, decoderinputs, targets_, targetweights = \ tool.make_inputs(contents, title, word_to_ix, encoder_size=encoder_size, decoder_size=decoder_size, shuffle=False) test_encoderinputs, test_decoderinputs, test_targets_, test_targetweights = \
import tensorflow as tf import numpy as np import tool as tool import time # data loading data_path = 'C:/newscorpus.csv' title, contents = tool.loading_data(data_path, eng=False, num=False, punc=False) word_to_ix, ix_to_word = tool.make_dict_all_cut(title+contents, minlength=0, maxlength=3, jamo_delete=True) # parameters multi = True forward_only = False hidden_size = 300 vocab_size = len(ix_to_word) num_layers = 3 learning_rate = 0.001 batch_size = 16 encoder_size = 100 decoder_size = tool.check_doclength(title,sep=True) # (Maximum) number of time steps in this batch steps_per_checkpoint = 10 # transform data encoderinputs, decoderinputs, targets_, targetweights = \ tool.make_inputs(contents, title, word_to_ix, encoder_size=encoder_size, decoder_size=decoder_size, shuffle=False) class seq2seq(object): def __init__(self, multi, hidden_size, num_layers, forward_only, learning_rate, batch_size,