blob: 82ee9f886da87c7c16cc0d9cd1f7c84b13a3fcc8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#pragma once
#include "clickhouse_config.h"
#if USE_NLP
#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>;
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
|