Moved test after filter

This commit is contained in:
Blu3train 2021-11-29 17:24:16 +01:00 committed by Akash Mozumdar
parent 306b9f0525
commit b09783d111

View File

@ -153,7 +153,7 @@ private:
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
{ {
if (sentenceInfo["text number"] == 0 || sentence.size() > maxSentenceSize || !std::regex_replace(sentence, std::wregex(L"\\s|\u200B"), L"").length()) return false; if (sentenceInfo["text number"] == 0 || sentence.size() > maxSentenceSize) return false;
static class static class
{ {
@ -188,6 +188,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
Trim(sentence); Trim(sentence);
sentence.erase(std::remove_if(sentence.begin(), sentence.end(), [](wchar_t ch) { return ch < ' ' && ch != '\n'; }), sentence.end()); sentence.erase(std::remove_if(sentence.begin(), sentence.end(), [](wchar_t ch) { return ch < ' ' && ch != '\n'; }), sentence.end());
} }
if (!std::regex_replace(sentence, std::wregex(L"\\s|\x200b"), L"").size()) return false;
if (useCache) if (useCache)
{ {
auto translationCache = ::translationCache.Acquire(); auto translationCache = ::translationCache.Acquire();