예제 #1
0
def sample_text(sess, data_provider, iteration):
    model = RNNModel(data_provider.vocabulary_size, batch_size=1, sequence_length=1, hidden_layer_size=HIDDEN_LAYER_SIZE, cells_size=CELLS_SIZE, training=False)
    text = model.sample(sess, data_provider.chars, data_provider.vocabulary, TEXT_SAMPLE_LENGTH)#.encode("utf-8")
    output = open(output_file, "a")
    output.write("Iteration: " + str(iteration) + "\n")
    output.write(str(text) + "\n")
    output.write("\n")
    output.close()
예제 #2
0
def sample_text(sess, data_provider, iteration):
    model = RNNModel(data_provider.vocabulary_size,
                     batch_size=1,
                     sequence_length=1,
                     hidden_layer_size=HIDDEN_LAYER_SIZE,
                     cells_size=CELLS_SIZE,
                     training=False)
    text = model.sample(sess, data_provider.chars, data_provider.vocabulary,
                        TEXT_SAMPLE_LENGTH).encode("utf-8")
    with open(output_file, "a") as output:
        output.write("Iteration: " + str(iteration) + "\n")
        output.write(text + "\n")
        output.write("\n")

    analysis = get_linguistic_analysis(text)
    print(analysis)
    with open(data_dir + "analysis.txt", mode="a",
              encoding='utf-8') as analysis_file:
        analysis_file.write("Iteration: " + str(iteration) + "\n")
        analysis_file.write(analysis)
        analysis_file.write("\n")
예제 #3
0
def sample_text(sess, data_provider, iteration):
    model = RNNModel(data_provider.vocabulary_size, batch_size=1, sequence_length=1, hidden_layer_size=HIDDEN_LAYER_SIZE, cells_size=CELLS_SIZE, training=False)
    text = model.sample(sess, data_provider.chars, data_provider.vocabulary, TEXT_SAMPLE_LENGTH).encode('utf-8')
    with open(output_file, 'a') as output:
        output.write(f'Iteration: {iteration}\n{text}\n\n')