commit d6119dd157d89111a9930481fef04440ccd36d5f Author: Tanmai Khanna Date: Tue Aug 20 00:48:09 2019 +0530 Fixed wcout bug by changing all to fputws and fputwc diff --git a/src/anaphora.cc b/src/anaphora.cc index 9416ce7..2bacdcf 100644 --- a/src/anaphora.cc +++ b/src/anaphora.cc @@ -158,20 +158,20 @@ int main(int argc, char **argv) { if(flag_LU == 0) // not inside LU { - fwprintf(stdout, L"%C", input_char); + fputwc(input_char, stdout); input_char = fgetwc(stdin); - fwprintf(stdout, L"%C", input_char); + fputwc(input_char, stdout); } else //inside LU { input_stream.push_back(input_char); - fwprintf(stdout, L"%C", input_char); + fputwc(input_char, stdout); input_char = fgetwc(stdin); - fwprintf(stdout, L"%C", input_char); + fputwc(input_char, stdout); input_stream.push_back(input_char); } } @@ -179,7 +179,7 @@ int main(int argc, char **argv) { if(flag_LU == 0) //Not Part of an LU { - fwprintf(stdout, L"%C", input_char); + fputwc(input_char, stdout); if(input_char == L'^') flag_LU = 1; @@ -191,9 +191,10 @@ int main(int argc, char **argv) { gen_id++; //generate ids for LUs - fwprintf(stdout, L"/"); //for adding ref + fputwc(L'/', stdout); //for adding ref flag_LU = 0; + ParseLexicalUnit LU(input_stream); //Parse Lexical Unit using parse_biltrans tl_form = LU.get_tl_form(); @@ -212,7 +213,8 @@ int main(int argc, char **argv) if(retval == 1) { final_ref = score_module.get_antecedent(); - wcout << final_ref; //add antecedent to side ref of LU //CHANGE + + fputws(final_ref.c_str(), stdout); //add antecedent to side ref of LU } } @@ -223,7 +225,7 @@ int main(int argc, char **argv) input_stream.push_back(input_char); } - fwprintf(stdout, L"%C", input_char); + fputwc(input_char, stdout); } } diff --git a/src/parse_biltrans.cc b/src/parse_biltrans.cc index 9d28f93..6c6d822 100644 --- a/src/parse_biltrans.cc +++ b/src/parse_biltrans.cc @@ -33,7 +33,7 @@ ParseLexicalUnit::ParseLexicalUnit(wstring input_LU) for (std::wstring::iterator i = input_LU.begin(); i != input_LU.end(); ++i) { - if(*i == '\\') //dealing with escaped characters + if(*i == L'\\') //dealing with escaped characters { if(seenSlash == 0) //sl { @@ -75,19 +75,19 @@ ParseLexicalUnit::ParseLexicalUnit(wstring input_LU) } } - else if(*i == '/') + else if(*i == L'/') seenSlash++; else if(seenSlash == 0) //sl { sl_form.push_back(*i); //add to the sl form - if(*i == '<') //start reading tag + if(*i == L'<') //start reading tag seenTag++; else if(seenTag == 1) //inside a tag { - if(*i == '>') //if tag ends + if(*i == L'>') //if tag ends { seenTag--; sl_tags.push_back(temptag); //add tag to list of sl tags @@ -104,13 +104,13 @@ ParseLexicalUnit::ParseLexicalUnit(wstring input_LU) else if(seenSlash == 1) //tl (only first entry in tl) { tl_form.push_back(*i); //add to the tl form - - if(*i == '<') //start reading tag + + if(*i == L'<') //start reading tag seenTag++; else if(seenTag == 1) //inside a tag { - if(*i == '>') //if tag ends + if(*i == L'>') //if tag ends { seenTag--; tl_tags.push_back(temptag); //add tag to list of tl tags diff --git a/src/score.cc b/src/score.cc index 6a37806..c3da674 100644 --- a/src/score.cc +++ b/src/score.cc @@ -192,8 +192,8 @@ wstring Scoring::get_antecedent() for(vector::iterator it=antecedent_list.begin();it!=antecedent_list.end();++it) //read from furthest to nearest { - //cerr << "\n" << (*it).LU.id << ": "; - //wcerr << (*it).LU.wordform; + //cerr << "\n" << (*it).LU.id << ": "; //for debugging + //fputws((*it).LU.wordform.c_str(), stderr); //cerr << " : " << (*it).score << "\n"; if((*it).score >= final_antecedent.score) //picking the highest scored and latest added (most recent) antecedent