From 19a5ef4a1a64fcc77741db7e900b2fa7294434e2 Mon Sep 17 00:00:00 2001 From: Matthias Huck Date: Thu, 17 Jul 2014 20:19:28 +0100 Subject: [PATCH] relax-parse: use cin.peek() Hope this eliminates some weird behavior --- phrase-extract/relax-parse-main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phrase-extract/relax-parse-main.cpp b/phrase-extract/relax-parse-main.cpp index e5feb94d0..b415c4d0e 100644 --- a/phrase-extract/relax-parse-main.cpp +++ b/phrase-extract/relax-parse-main.cpp @@ -31,15 +31,15 @@ int main(int argc, char* argv[]) // loop through all sentences int i=0; - string inBuffer; - while(getline(cin, inBuffer)) { + string inBufferString; + while(cin.peek() != EOF) { + getline(cin,inBufferString); i++; if (i%1000 == 0) cerr << "." << flush; if (i%10000 == 0) cerr << ":" << flush; if (i%100000 == 0) cerr << "!" << flush; // process into syntax tree representation - string inBufferString = string( inBuffer ); set< string > labelCollection; // set of labels, not used map< string, int > topLabelCollection; // count of top labels, not used SyntaxTree tree;