LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
WordUnit.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_WORDUNIT_H
7#define LIMA_WORDSENSEDISAMBIGUATION_WORDUNIT_H
8
10#include <vector>
11#include <set>
12#include <map>
13#include "WordSenseUnit.h"
14#include "CommonTypedefs.h"
15#include "KnnSearcher.h"
16
17namespace Lima
18{
19namespace LinguisticProcessing
20{
21namespace WordSenseDisambiguation
22{
23
24
25typedef std::map<uint64_t, std::string> Index2Lemma;
26typedef std::map<std::string, uint64_t> Lemma2Index;
27
28
29
30
31
33{
34 public:
35 WordUnit();
36 ~WordUnit();
37 WordUnit(KnnSearcher* searcher,
38 const Lemma2Index& lemma2Index,
39 const Index2Lemma& index2Lemma,
40 std::string lemma,
41 Mode mode,
42 std::string sensesPath);
43
44 friend LIMA_WORDSENSEANALYSIS_EXPORT std::ostream& operator << (std::ostream& os, const WordUnit& wu);
45 friend LIMA_WORDSENSEANALYSIS_EXPORT QDebug& operator << (QDebug& os, const WordUnit& wu);
46
47 const std::string& lemma() const ;
48 uint64_t lemmaId() const ;
49 Mode mode() const ;
50 int nbSenses() const ;
51 const std::set<WordSenseUnit>& wordSensesUnits() const;
52
53 protected:
54 std::string m_lemma;
55 uint64_t m_lemmaId;
58 std::set<WordSenseUnit> m_senses;
59
60
61 int loadSenses(KnnSearcher* searcher,
62 const Lemma2Index& lemma2Index,
63 const Index2Lemma& index2Lemma,
64 std::string sensesPath);
65};
66
67inline const std::string& WordUnit::lemma() const
68{
69 return m_lemma;
70}
71inline uint64_t WordUnit::lemmaId() const
72{
73 return m_lemmaId;
74}
75inline Mode WordUnit::mode() const
76{
77 return m_mode;
78}
79inline int WordUnit::nbSenses() const
80{
81 return m_nbSenses;
82}
83inline const std::set<WordSenseUnit>& WordUnit::wordSensesUnits() const
84{
85 return m_senses;
86}
87
88} // namespace WordSenseDisambiguation
89} // namespace LinguisticProcessing
90} // namespace Lima
91
92
93#endif // LIMA_WORDSENSEDISAMBIGUATION_WORDUNIT_H
QDebug & operator<<(QDebug &qd, const std::string &str)
Definition QsLog.cpp:39
#define LIMA_WORDSENSEANALYSIS_EXPORT
const std::set< WordSenseUnit > & wordSensesUnits() const
Definition WordUnit.h:83
std::map< std::string, uint64_t > Lemma2Index
Definition WordUnit.h:26
std::map< uint64_t, std::string > Index2Lemma
Definition WordUnit.h:25
NAUTITIA.