ClickHouse/src/Interpreters/SynonymsExtensions.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

56 lines
946 B
C++
Raw Normal View History

#pragma once
2021-10-27 23:10:39 +00:00
#include "config_core.h"
#if USE_NLP
2021-10-02 07:13:14 +00:00
#include <base/types.h>
#include <Poco/Util/Application.h>
#include <memory>
#include <mutex>
#include <string_view>
#include <vector>
#include <unordered_map>
namespace DB
{
class ISynonymsExtension
{
public:
using Synset = std::vector<String>;
virtual const Synset * getSynonyms(std::string_view token) const = 0;
virtual ~ISynonymsExtension() = default;
};
class SynonymsExtensions
{
public:
using ExtPtr = std::shared_ptr<ISynonymsExtension>;
2021-06-20 12:31:07 +00:00
explicit SynonymsExtensions(const Poco::Util::AbstractConfiguration & config);
ExtPtr getExtension(const String & name);
private:
struct Info
{
String path;
String type;
};
using ExtContainer = std::unordered_map<String, ExtPtr>;
using InfoContainer = std::unordered_map<String, Info>;
std::mutex mutex;
ExtContainer extensions;
InfoContainer info;
};
}
#endif