SOMHunter Core
keyword-clip-ranker.h
Go to the documentation of this file.
1 /* This file is part of SOMHunter.
2  *
3  * Copyright (C) 2021 Frantisek Mejzlik <frankmejzlik@protonmail.com>
4  * Mirek Kratochvil <exa.exa@gmail.com>
5  * Patrik Vesely <prtrikvesely@gmail.com>
6  *
7  * SOMHunter is free software: you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License as published by the Free
9  * Software Foundation, either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * SOMHunter is distributed in the hope that it will be useful, but WITHOUT ANY
13  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15  * details.
16  *
17  * You should have received a copy of the GNU General Public License along with
18  * SOMHunter. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef KEYWORD_CLIP_RANKER_H_
22 #define KEYWORD_CLIP_RANKER_H_
23 
24 #include <cassert>
25 #include <fstream>
26 #include <iomanip>
27 #include <map>
28 #include <set>
29 #include <string>
30 #include <vector>
31 // ---
32 #include "common.h"
33 #include "embedding-ranker.h"
34 #include "http.h"
35 #include "utils.hpp"
36 
37 namespace sh {
38 class KeywordClipRanker : public EmbeddingRanker<SecondaryFrameFeatures> {
39 public:
40  inline KeywordClipRanker(const Settings& config) : server_url(config.remote_services.CLIP_query_to_vec.address) {}
41 
42  void rank_sentence_query(const std::string& sentence_query, ScoreModel& model,
43  const SecondaryFrameFeatures& _dataset_features, size_t temporal);
44 
45 private:
47  std::string server_url;
48 };
49 }; // namespace sh
50 
51 #endif // KEYWORD_CLIP_RANKER_H_
Definition: embedding-ranker.h:43
Definition: http.h:38
Definition: keyword-clip-ranker.h:38
KeywordClipRanker(const Settings &config)
Definition: keyword-clip-ranker.h:40
void rank_sentence_query(const std::string &sentence_query, ScoreModel &model, const SecondaryFrameFeatures &_dataset_features, size_t temporal)
Definition: keyword-clip-ranker.cpp:28
Http _http
Definition: keyword-clip-ranker.h:46
std::string server_url
Definition: keyword-clip-ranker.h:47
Definition: scores.h:34
Definition: common-types.h:33
Parsed current config of the core.
Definition: settings.h:190