destroy garbage sentences

This commit is contained in:
Akash Mozumdar 2022-01-01 21:40:03 -07:00
parent b09783d111
commit dad036083a

View File

@ -188,7 +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 (sentence.empty()) return true;
if (useCache) if (useCache)
{ {
auto translationCache = ::translationCache.Acquire(); auto translationCache = ::translationCache.Acquire();