mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Minor fixes
This commit is contained in:
parent
8cb25c5757
commit
00154d3163
@ -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 ()
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include <Functions/FunctionHelpers.h>
|
||||
#include <Functions/IFunction.h>
|
||||
#include <Interpreters/Context.h>
|
||||
#include <Interpreters/Lemmatizers.cpp>
|
||||
#include <Interpreters/Lemmatizers.h>
|
||||
|
||||
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; }
|
||||
|
@ -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<const char *>(data.data() + offsets[i - 1]), offsets[i] - offsets[i - 1] - 1);
|
||||
|
||||
auto synset = extension->getSynonyms(word);
|
||||
const auto * synset = extension->getSynonyms(word);
|
||||
|
||||
if (synset)
|
||||
{
|
||||
|
@ -15,17 +15,15 @@ namespace ErrorCodes
|
||||
}
|
||||
|
||||
|
||||
class Lemmatizer
|
||||
class Lemmatizer : public ILemmatizer
|
||||
{
|
||||
private:
|
||||
RdrLemmatizer lemmatizer;
|
||||
|
||||
public:
|
||||
using TokenPtr = std::shared_ptr<char []>;
|
||||
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));
|
||||
}
|
||||
|
@ -9,12 +9,21 @@
|
||||
namespace DB
|
||||
{
|
||||
|
||||
class Lemmatizer;
|
||||
class ILemmatizer
|
||||
{
|
||||
public:
|
||||
using TokenPtr = std::shared_ptr<char []>;
|
||||
|
||||
virtual TokenPtr lemmatize(const char * token) = 0;
|
||||
|
||||
virtual ~ILemmatizer() = default;
|
||||
};
|
||||
|
||||
|
||||
class Lemmatizers
|
||||
{
|
||||
public:
|
||||
using LemmPtr = std::shared_ptr<Lemmatizer>;
|
||||
using LemmPtr = std::shared_ptr<ILemmatizer>;
|
||||
|
||||
private:
|
||||
std::mutex mutex;
|
||||
@ -22,7 +31,7 @@ private:
|
||||
std::unordered_map<String, String> paths;
|
||||
|
||||
public:
|
||||
Lemmatizers(const Poco::Util::AbstractConfiguration & config);
|
||||
explicit Lemmatizers(const Poco::Util::AbstractConfiguration & config);
|
||||
|
||||
LemmPtr getLemmatizer(const String & name);
|
||||
};
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ class SynonymsExtensions
|
||||
public:
|
||||
using ExtPtr = std::shared_ptr<ISynonymsExtension>;
|
||||
|
||||
SynonymsExtensions(const Poco::Util::AbstractConfiguration & config);
|
||||
explicit SynonymsExtensions(const Poco::Util::AbstractConfiguration & config);
|
||||
|
||||
ExtPtr getExtension(const String & name);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user