diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2014-06-08 19:23:14 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2014-06-08 19:23:14 +0400 |
commit | cb94a3181bd00c74bf0b2b81fea4aee2195dc121 (patch) | |
tree | 3bedb39ba6be32a408583c965ace9e68f23861a0 /phrase-extract/DomainFeature.cpp | |
parent | 23ba0de2247e84db69759445a41c4c4f04840460 (diff) |
use standard c++ getline instead of old Moses SAFE_GETLINE
Diffstat (limited to 'phrase-extract/DomainFeature.cpp')
-rw-r--r-- | phrase-extract/DomainFeature.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/phrase-extract/DomainFeature.cpp b/phrase-extract/DomainFeature.cpp index 2f99a8709..337364b1d 100644 --- a/phrase-extract/DomainFeature.cpp +++ b/phrase-extract/DomainFeature.cpp @@ -4,8 +4,6 @@ #include "InputFileStream.h" #include "SafeGetline.h" -#define TABLE_LINE_MAX_LENGTH 1000 - using namespace std; namespace MosesTraining @@ -16,12 +14,11 @@ void Domain::load( const std::string &domainFileName ) { Moses::InputFileStream fileS( domainFileName ); istream *fileP = &fileS; - while(true) { - char line[TABLE_LINE_MAX_LENGTH]; - SAFE_GETLINE((*fileP), line, TABLE_LINE_MAX_LENGTH, '\n', __FILE__); - if (fileP->eof()) break; + + string line; + while(getline(*fileP, line)) { // read - vector< string > domainSpecLine = tokenize( line ); + vector< string > domainSpecLine = tokenize( line.c_str() ); int lineNumber; if (domainSpecLine.size() != 2 || ! sscanf(domainSpecLine[0].c_str(), "%d", &lineNumber)) { |