diff --git a/contrib/boost-cmake/CMakeLists.txt b/contrib/boost-cmake/CMakeLists.txt index d00179f13cd..675931d319f 100644 --- a/contrib/boost-cmake/CMakeLists.txt +++ b/contrib/boost-cmake/CMakeLists.txt @@ -236,5 +236,6 @@ if (NOT EXTERNAL_BOOST_FOUND) add_library (_boost_graph ${SRCS_GRAPH}) add_library (boost::graph ALIAS _boost_graph) target_include_directories (_boost_graph PRIVATE ${LIBRARY_DIR}) + target_link_libraries(_boost_graph PRIVATE _boost_regex) endif () diff --git a/src/Functions/lemmatize.cpp b/src/Functions/lemmatize.cpp index bee37594f4c..704d5f87575 100644 --- a/src/Functions/lemmatize.cpp +++ b/src/Functions/lemmatize.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include namespace DB { @@ -62,7 +62,7 @@ private: Lemmatizers & lemmatizers; public: - FunctionLemmatize(Lemmatizers & lemmatizers_) + explicit FunctionLemmatize(Lemmatizers & lemmatizers_) : lemmatizers(lemmatizers_) {} String getName() const override { return name; } diff --git a/src/Functions/synonyms.cpp b/src/Functions/synonyms.cpp index 6c630861f60..b846a2e0486 100644 --- a/src/Functions/synonyms.cpp +++ b/src/Functions/synonyms.cpp @@ -33,7 +33,7 @@ private: SynonymsExtensions & extensions; public: - FunctionSynonyms(SynonymsExtensions & extensions_) + explicit FunctionSynonyms(SynonymsExtensions & extensions_) : extensions(extensions_) {} String getName() const override { return name; } @@ -92,7 +92,7 @@ public: { std::string_view word(reinterpret_cast(data.data() + offsets[i - 1]), offsets[i] - offsets[i - 1] - 1); - auto synset = extension->getSynonyms(word); + const auto * synset = extension->getSynonyms(word); if (synset) { diff --git a/src/Interpreters/Lemmatizers.cpp b/src/Interpreters/Lemmatizers.cpp index b2e63851d33..3e43d0aa090 100644 --- a/src/Interpreters/Lemmatizers.cpp +++ b/src/Interpreters/Lemmatizers.cpp @@ -15,17 +15,15 @@ namespace ErrorCodes } -class Lemmatizer +class Lemmatizer : public ILemmatizer { private: RdrLemmatizer lemmatizer; public: - using TokenPtr = std::shared_ptr; + explicit Lemmatizer(const String & path) : lemmatizer(path.data()) {} - Lemmatizer(const String & path) : lemmatizer(path.data()) {} - - TokenPtr lemmatize(const char * token) + TokenPtr lemmatize(const char * token) override { return TokenPtr(lemmatizer.Lemmatize(token)); } diff --git a/src/Interpreters/Lemmatizers.h b/src/Interpreters/Lemmatizers.h index b58839f05b2..dd3050aed45 100644 --- a/src/Interpreters/Lemmatizers.h +++ b/src/Interpreters/Lemmatizers.h @@ -9,12 +9,21 @@ namespace DB { -class Lemmatizer; +class ILemmatizer +{ +public: + using TokenPtr = std::shared_ptr; + + virtual TokenPtr lemmatize(const char * token) = 0; + + virtual ~ILemmatizer() = default; +}; + class Lemmatizers { public: - using LemmPtr = std::shared_ptr; + using LemmPtr = std::shared_ptr; private: std::mutex mutex; @@ -22,7 +31,7 @@ private: std::unordered_map paths; public: - Lemmatizers(const Poco::Util::AbstractConfiguration & config); + explicit Lemmatizers(const Poco::Util::AbstractConfiguration & config); LemmPtr getLemmatizer(const String & name); }; diff --git a/src/Interpreters/SynonymsExtensions.cpp b/src/Interpreters/SynonymsExtensions.cpp index 9671b605ed1..b2698e8f652 100644 --- a/src/Interpreters/SynonymsExtensions.cpp +++ b/src/Interpreters/SynonymsExtensions.cpp @@ -27,7 +27,7 @@ private: LookupTable table; public: - PlainSynonymsExtension(const String & path) + explicit PlainSynonymsExtension(const String & path) { std::ifstream file(path); if (!file.is_open()) @@ -66,7 +66,7 @@ private: wnb::wordnet wn; public: - WordnetSynonymsExtension(const String & path) : wn(path) {} + explicit WordnetSynonymsExtension(const String & path) : wn(path) {} const Synset * getSynonyms(const std::string_view & token) const override { diff --git a/src/Interpreters/SynonymsExtensions.h b/src/Interpreters/SynonymsExtensions.h index c8da2e338ac..3b00122a419 100644 --- a/src/Interpreters/SynonymsExtensions.h +++ b/src/Interpreters/SynonymsExtensions.h @@ -27,7 +27,7 @@ class SynonymsExtensions public: using ExtPtr = std::shared_ptr; - SynonymsExtensions(const Poco::Util::AbstractConfiguration & config); + explicit SynonymsExtensions(const Poco::Util::AbstractConfiguration & config); ExtPtr getExtension(const String & name);