#include #include void vector2file(std::vector vector, std::string saveFileName){ std::ofstream f(saveFileName); for(std::vector::const_iterator i = vector.begin(); i != vector.end(); ++i) { f << *i << '\n'; } } std::vector hyps2result(std::map token_map, std::vector> hyps, int context_size = 2){ std::vector results; for (int k=0; k < hyps.size(); k++){ std::string result = token_map[hyps[k][context_size]]; for (int i=context_size+1; i < hyps[k].size(); i++){ std::string token = token_map[hyps[k][i]]; // TODO: recognising '_' is not working if (token.at(0) == '_') result += " " + token; else result += token; } results.push_back(result); } return results; } void print_hyps(std::vector> hyps, int context_size = 2){ std::cout << "Hyps:" << std::endl; for (int i=context_size; i