Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieu@hoang.co.uk>2014-06-08 18:41:27 +0400
committerHieu Hoang <hieu@hoang.co.uk>2014-06-08 18:41:27 +0400
commit23ba0de2247e84db69759445a41c4c4f04840460 (patch)
tree0ace1b8a46aada207d2d6e71a14d61eafaa58ed5 /phrase-extract/extract-main.cpp
parentd979b24314944348cea2d7f8d8e00691c64abebb (diff)
use standard c++ getline instead of old Moses SAFE_GETLINE
Diffstat (limited to 'phrase-extract/extract-main.cpp')
-rw-r--r--phrase-extract/extract-main.cpp28
1 files changed, 13 insertions, 15 deletions
diff --git a/phrase-extract/extract-main.cpp b/phrase-extract/extract-main.cpp
index 5d58028d6..698599a10 100644
--- a/phrase-extract/extract-main.cpp
+++ b/phrase-extract/extract-main.cpp
@@ -32,10 +32,6 @@ using namespace MosesTraining;
namespace MosesTraining
{
-
-const long int LINE_MAX_LENGTH = 500000 ;
-
-
// HPhraseVertex represents a point in the alignment matrix
typedef pair <int, int> HPhraseVertex;
@@ -277,20 +273,18 @@ int main(int argc, char* argv[])
int i = sentenceOffset;
- while(true) {
+ string englishString, foreignString, alignmentString, weightString;
+
+ while(getline(*eFileP, englishString)) {
i++;
if (i%10000 == 0) cerr << "." << flush;
- char englishString[LINE_MAX_LENGTH];
- char foreignString[LINE_MAX_LENGTH];
- char alignmentString[LINE_MAX_LENGTH];
- char weightString[LINE_MAX_LENGTH];
- SAFE_GETLINE((*eFileP), englishString, LINE_MAX_LENGTH, '\n', __FILE__);
- if (eFileP->eof()) break;
- SAFE_GETLINE((*fFileP), foreignString, LINE_MAX_LENGTH, '\n', __FILE__);
- SAFE_GETLINE((*aFileP), alignmentString, LINE_MAX_LENGTH, '\n', __FILE__);
+
+ getline(*fFileP, foreignString);
+ getline(*aFileP, alignmentString);
if (iwFileP) {
- SAFE_GETLINE((*iwFileP), weightString, LINE_MAX_LENGTH, '\n', __FILE__);
+ getline(*iwFileP, weightString);
}
+
SentenceAlignment sentence;
// cout << "read in: " << englishString << " & " << foreignString << " & " << alignmentString << endl;
//az: output src, tgt, and alingment line
@@ -300,7 +294,11 @@ int main(int argc, char* argv[])
cout << "LOG: ALT: " << alignmentString << endl;
cout << "LOG: PHRASES_BEGIN:" << endl;
}
- if (sentence.create( englishString, foreignString, alignmentString, weightString, i, false)) {
+ if (sentence.create( englishString.c_str(),
+ foreignString.c_str(),
+ alignmentString.c_str(),
+ weightString.c_str(),
+ i, false)) {
if (options.placeholders.size()) {
sentence.invertAlignment();
}