Shawn1993/cnn-text-classification-pytorch

Output raw input sentences

Closed this issue · 1 comments

Is there a easy way to get the original raw sentences instead of data objects during the test dataset evaluation?

def eval(data_iter, model, args):
    model.eval()
    corrects, avg_loss = 0, 0
    for batch in data_iter:
        feature, target = batch.text, batch.label
        **print (feature.original_sentence)**

I figured to use index to get the string out.