Fixed tests

This commit is contained in:
Maksim Kita 2022-03-15 15:43:31 +00:00
parent b202130841
commit 8bdb906acb
3 changed files with 11 additions and 23 deletions

View File

@ -62,35 +62,29 @@ public:
return instance;
}
const Map & getEmotionalDict()
const Map & getEmotionalDict() const
{
std::lock_guard lock(mutex);
if (emotional_dict.empty())
loadEmotionalDict();
return emotional_dict;
}
const EncodingContainer & getEncodingsFrequency()
const EncodingContainer & getEncodingsFrequency() const
{
std::lock_guard lock(mutex);
if (encodings_freq.empty())
loadEncodingsFrequency();
return encodings_freq;
}
const Container & getProgrammingFrequency()
const Container & getProgrammingFrequency() const
{
std::lock_guard lock(mutex);
if (programming_freq.empty())
loadProgrammingFrequency();
return programming_freq;
}
private:
FrequencyHolder() {
loadEmotionalDict();
loadEncodingsFrequency();
loadProgrammingFrequency();
}
void loadEncodingsFrequency()
{
Poco::Logger * log = &Poco::Logger::get("EncodingsFrequency");
@ -149,7 +143,6 @@ private:
LOG_TRACE(log, "Charset frequencies was added, charsets count: {}", encodings_freq.size());
}
void loadEmotionalDict()
{
Poco::Logger * log = &Poco::Logger::get("EmotionalDict");
@ -188,7 +181,6 @@ private:
LOG_TRACE(log, "Emotional dictionary was added. Word count: {}", std::to_string(count));
}
void loadProgrammingFrequency()
{
Poco::Logger * log = &Poco::Logger::get("ProgrammingFrequency");
@ -246,7 +238,5 @@ private:
Map emotional_dict;
Container programming_freq;
EncodingContainer encodings_freq;
std::mutex mutex;
};
}

View File

@ -20,7 +20,7 @@ namespace
constexpr size_t max_string_size = 1UL << 15;
template <typename ModelMap>
static ALWAYS_INLINE inline Float64 naiveBayes(
ALWAYS_INLINE inline Float64 naiveBayes(
const FrequencyHolder::EncodingMap & standard,
const ModelMap & model,
Float64 max_result)
@ -48,7 +48,7 @@ namespace
/// Сount how many times each bigram occurs in the text.
template <typename ModelMap>
static ALWAYS_INLINE inline void calculateStats(
ALWAYS_INLINE inline void calculateStats(
const UInt8 * data,
const size_t size,
ModelMap & model)

View File

@ -98,8 +98,6 @@ struct NormalizeUTF8Impl
ColumnString::Offset current_from_offset = 0;
ColumnString::Offset current_to_offset = 0;
icu::UnicodeString to_string;
PODArray<UChar> from_uchars;
PODArray<UChar> to_uchars;