LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
KnnSearcher.h
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
6#ifndef LIMA_WORDSENSEDISAMBIGUATION_KNNSEARCHER_H
7#define LIMA_WORDSENSEDISAMBIGUATION_KNNSEARCHER_H
8
10#include "hasheddb.h"
11#include "lshsignature.h"
12#include "CommonTypedefs.h"
13#include <string.h>
14
15#include <map>
16#include <set>
17#include <string>
18#include <vector>
19
20
21namespace Lima
22{
23namespace LinguisticProcessing
24{
25namespace WordSenseDisambiguation
26{
27
28typedef std::map<uint64_t, float> NNList;
29typedef std::map<std::string, HashedDB*> HashedData;
30
31
32
33
35{
36 public :
37 KnnSearcher(const std::map<std::string, std::string>& knnsearchConfig);
38
40
41 int getKNN(uint64_t lemmaId,
42 SemanticContext::const_iterator itContext,
43 NNList& knns);
44 uint64_t owner2Sys(uint64_t ownerId);
45 uint64_t sys2Owner(uint64_t systemId);
46
47 protected :
48 std::string m_hashedDir ;
50 char* m_hkMap;
51 uint64_t m_hkMapSize;
52 //uint64_t m_hashedDbMapSize;
57 int m_beam;
58 int m_k;
59
60 std::map<uint64_t,uint64_t> m_owner2System;
61 std::map<uint64_t, uint64_t> m_system2Owner;
62
63 void mapHashKey(std::string relation);
64 //void mapHashedDB(std::string relation);
65 LSHSignature* buildSignature(SemanticContext::const_iterator itContext);
66 int fastKNNSort(HashedDB &xoredDB, vectorCount* finalResult);
67
68};
69
70
71
72}
73}
74}
75#endif // LIMA_WORDSENSEDISAMBIGUATION_KNNSEARCHER_H
#define LIMA_WORDSENSEANALYSIS_EXPORT
std::map< std::string, HashedDB * > HashedData
Definition KnnSearcher.h:29
NAUTITIA.