diff --git a/extensions/removerepeat/removerepeat.cpp b/extensions/removerepeat/removerepeat.cpp index 138837f..61742c7 100644 --- a/extensions/removerepeat/removerepeat.cpp +++ b/extensions/removerepeat/removerepeat.cpp @@ -22,7 +22,17 @@ void RemoveRepeatedChars(std::wstring& sentence) void RemoveCyclicRepeats(std::wstring& sentence) { - for (std::wsmatch results; std::regex_search(sentence, results, std::wregex(L"^([^\\x00]{5,})[^\\x00]*?\\1")); sentence.erase(0, results[1].length())); +remove: + std::wstring junk = sentence; + while (junk.size() > 4) + { + junk.pop_back(); + if (sentence.rfind(junk) > 0) + { + sentence.erase(0, junk.size()); + goto remove; + } + } } bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)