i have a python code for predicting machine learning nlp the below code used for prediction
by text file but i modified to get the input form terminal instead of reading file
and now i want to see the output instead save it to the file
i did not understand or how to use fmt=%
code:
for prediction in predictions:
print('16')
print(type(prediction))
# sequence = ' '.join([y_ix_to_word[index] for index in prediction if index > 0])
sequence = ' '.join([y_ix_to_word[index] for index in prediction if index > 0])
print('17')
print(sequence)
print('18')
sequences.append(sequence)
print('19')
print('20')
print(sequences)
print(type(sequences))
np.savetxt('test_result.txt', sequences, fmt='%s')
i just want make a print instead of save to a file