     std::ifstream file(path);
     std::string line;
     while (std::getline(file, line).good()) {
-        output.push_back(Split(line, " ||| "));
+      boost::trim(line);
+      output.push_back(Split(line, " ||| "));
     }
 }
 

      sentences2score.clear();
      for (; (nbestIndex < nbest.size()) && (sentences2score.size() < maxBatchSize); ++nbestIndex) {
        if (boost::lexical_cast<size_t>(nbest[nbestIndex][0]) == index) {
          std::string sentence = nbest[nbestIndex][1] + " </s>";
          sentences2score.push_back(tvcb.Encode(Split(sentence)));
        }
        else {

  decoder.EmptyState(PrevState, SourceContext, batchSize);
  decoder.EmptyEmbedding(PrevEmbedding, batchSize);

  std::vector<float> scores(batch[0].size(), float(0.0f));
  size_t lengthIndex = 0;
  for (auto& w : batch) {
    decoder.GetProbs(Probs, AlignedSourceContext,
