From dad036083a241e642d7c855adaa5f3667e3655ec Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Sat, 1 Jan 2022 21:40:03 -0700 Subject: [PATCH] destroy garbage sentences --- extensions/translatewrapper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/translatewrapper.cpp b/extensions/translatewrapper.cpp index f959bd1..17bb208 100644 --- a/extensions/translatewrapper.cpp +++ b/extensions/translatewrapper.cpp @@ -188,7 +188,7 @@ bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo) Trim(sentence); 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) { auto translationCache = ::translationCache.Acquire();