mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-23 08:54:12 +08:00
Moved test after filter
This commit is contained in:
parent
306b9f0525
commit
b09783d111
@ -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();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user