mosesdecoder/moses2/InMemoryTrie/utils.h

33 lines
584 B
C
Raw Permalink Normal View History

2017-02-03 13:10:03 +03:00
#pragma once
#include "InMemoryTrie.h"
2015-10-30 13:41:55 +03:00
#include <fstream>
#include <ostream>
#include <string>
#include <vector>
2015-11-11 19:23:49 +03:00
#include "legacy/Util2.h"
2015-11-13 13:40:55 +03:00
#include "../legacy/Factor.h"
#include "../legacy/InputFileStream.h"
2015-10-30 13:41:55 +03:00
using namespace std;
2015-12-10 23:49:30 +03:00
namespace Moses2
{
2016-03-31 23:00:16 +03:00
inline void ParseLineByChar(string& line, char c, vector<string>& substrings)
{
size_t i = 0;
size_t j = line.find(c);
2015-10-30 13:41:55 +03:00
2016-03-31 23:00:16 +03:00
while (j != string::npos) {
substrings.push_back(line.substr(i, j - i));
i = ++j;
j = line.find(c, j);
2015-10-30 13:41:55 +03:00
2016-03-31 23:00:16 +03:00
if (j == string::npos) substrings.push_back(line.substr(i, line.length()));
}
2015-10-30 13:41:55 +03:00
}
2015-12-10 23:49:30 +03:00
}