Index: branches/apertium-separable/src/lsx_processor.cc =================================================================== --- branches/apertium-separable/src/lsx_processor.cc (revision 81021) +++ branches/apertium-separable/src/lsx_processor.cc (revision 81022) @@ -4,7 +4,6 @@ #include #include -/* get the text between delim1 and delim2 */ wstring readFullBlock(FILE *input, wchar_t const delim1, wchar_t const delim2); wstring @@ -104,6 +103,7 @@ while(!feof(input)) { + // cout << outOfWord; int val = fgetwc(input); if(alive_states.size() == 0 && !finalFound) { @@ -119,6 +119,7 @@ if((val == L'^' && !isEscaped && outOfWord) || feof(input)) { + // wcout << L"OOW"; outOfWord = false; blankqueue.push_back(blank); blank = L""; @@ -139,6 +140,7 @@ for(vector::const_iterator it = alive_states.begin(); it != alive_states.end(); it++) { State s = *it; + fflush(output); s.step(alphabet(L"<$>")); if(s.size() > 0) { @@ -183,10 +185,12 @@ State s = *it; if(val < 0) { + fflush(output); s.step_override(val, alphabet(L""), val); } else if(val > 0) { + fflush(output); int val_lowercase = towlower(val); s.step_override(val_lowercase, alphabet(L""), val); // FIXME deal with cases! } @@ -217,7 +221,14 @@ // out[i+1] = L'^'; // } } - out = out.substr(0, out.length()-3); // remove extra trailing '$ ^' : '^ ' is excess, '$' will be added in the next loop with fputws(in,output) + out = out.substr(0, out.length()-3); // remove extra trailing + for(wchar_t& c : out) + { + if (c == L'$') + { + c = L'#'; + } + } fputws(out.c_str(), output); } } @@ -225,41 +236,8 @@ } else if(outOfWord) // FIXME need to deal with superblank stuff { - // wcout << (wchar_t) val << endl; - // wstring blank = L""; - - // while(val != L'^' || feof(input)) - // { - // blank += static_cast(val); - // val = fgetwc(input); - // } - // skip = true; - - // if(val == L' ') - // { - // wstring blank = L""; - // blank += static_cast(val); - // blankqueue.push_back(blank); - // // wcout << "b" << blank << "b"; - // } - // else if(val == L'[') // tag - // { - // wstring blank = readFullBlock(input, L'[', L']'); - // blankqueue.push_back(blank); - // wcout << "b"<< blank<<"B"; - // } - // FIXME anything between $ and ^ - // else - // { fputwc(val, output); continue; - // } - - // if(blankqueue.size() > 0) - // { - // // wcout << blankqueue.front(); - // blankqueue.pop_front(); - // } } else { @@ -267,11 +245,6 @@ } } - - // wcout << endl << endl << L"bq size: " << blankqueue.size() << endl; - // for (auto b : blankqueue) - // wcout << b << endl; - /* flushing rest of the blanks here */ for (wstring b : blankqueue) {