Index: branches/apertium-separable/src/lsx_FSTProcessor.cc =================================================================== --- branches/apertium-separable/src/lsx_FSTProcessor.cc (revision 81612) +++ branches/apertium-separable/src/lsx_FSTProcessor.cc (revision 81615) @@ -45,6 +45,7 @@ escaped_chars.insert(L'@'); escaped_chars.insert(L'<'); escaped_chars.insert(L'>'); + escaped_chars.insert(L'+'); caseSensitive = false; dictionaryCase = false; @@ -1183,6 +1184,7 @@ wstring blank, out, in, alt_out, alt_in; bool outOfWord = true; bool finalFound = false; + bool plus_thing = false; alive_states.push_back(*initial_state); @@ -1190,10 +1192,11 @@ { int val = fgetwc(input); - // if(val == L' ' && !outOfWord) - // { - // wcout << L"SPACE"; - // } + if(val == L'+' && isEscaped(val) && !outOfWord) + { + val = L'$'; + plus_thing = true; + } if((val == L'^' && isEscaped(val) && outOfWord) || feof(input)) { @@ -1276,20 +1279,17 @@ alt_out = L""; for (int i=0; i < (int) out.size(); i++) { - wchar_t c = out[i]; + wchar_t c = out.at(i); if(c == L'/') { - // out[i] = L'^'; alt_out += L'^'; } - else if(c == L'$' && out[i-1] == L'<' && out[i+1] == L'>') // FIXME indexing + else if(out[i-1] == L'<' && c == L'$' && out[i+1] == L'>') // indexing { - // out[i+1] = L'^'; - // out.erase(i-1, 1); alt_out += c; alt_out += L'^'; } - else if(!(c == L'<' && out[i+1] == L'$' && out[i+2] == L'>') && !(c == L'>' && out[i-1] == L'$' && out[i-2] == L'<')) + else if(!(c == L'<' && out[i+1] == L'$' && out[i+2] == L'>') && !(out[i-2] == L'<' && out[i-1] == L'$' && c == L'>')) { alt_out += c; } @@ -1296,15 +1296,21 @@ } out = alt_out; + if(out[out.length()-1] == L'^') { out = out.substr(0, out.length()-1); // extra ^ at the end + if(plus_thing) + { + out[out.size()-1] = L'+'; + plus_thing = false; } + } else // take# out ... of { for(int i=out.length()-1; i>=0; i--) // indexing { - if(out[i] == L'$') + if(out.at(i) == L'$') { out.insert(i+1, L" "); break; @@ -1322,24 +1328,20 @@ alt_out = L""; for(int i=0; i < (int) out.size(); i++) // indexing { - if((out[i] == L'$') && blankqueue.size() > 0) + if((out.at(i) == L'$') && blankqueue.size() > 0) { - // out.insert(i+1, blankqueue.front().c_str()); - alt_out += out[i]; + alt_out += out.at(i); alt_out += blankqueue.front().c_str(); blankqueue.pop(); } - else if(out[i] == L' ' && blankqueue.size() > 0) + else if(out.at(i) == L' ' && blankqueue.size() > 0) { - // out.insert(i+1, blankqueue.front().c_str()); - // out.erase(i,1); - // alt_out += L"!"; alt_out += blankqueue.front().c_str(); blankqueue.pop(); } else { - alt_out += out[i]; + alt_out += out.at(i); } } out = alt_out;