ddc
DwdsThesaurus.h
Go to the documentation of this file.
1 // DDC originally by Alexey Sokirko
2 // Changes and modifications 2011-2015 by Bryan Jurish
3 //
4 // This file is part of DDC.
5 //
6 // DDC is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU Lesser General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // DDC is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public License
17 // along with DDC. If not, see <http://www.gnu.org/licenses/>.
18 //
19 #ifndef __DwdsThesaurus_H_
20 #define __DwdsThesaurus_H_
21 
22 #include "../CommonLib/util_classes.h"
23 
24 
26 {
27  // all possible supernodes of the thesaurus Adel, H...
29  // a buffer to store pathes from the leaf to the root
30  vector<DWORD> Pathes;
31 
32  // an index which points to vector Pathes
33  // the count of PathEndIndex is equal to the count of leaves in the thesaurus
34  // Pathes[ PathEndIndex[i-1].... PathEndIndex[i] ] is a path number i
35  vector<DWORD> PathEndIndex;
36 
37  // an index which points to vector Pathes
38  vector<DWORD> LeavesPathes;
40 
42 
43 public:
44  bool LoadDwdsThesaurus ();
45  int FindHyperTerm (const string& s) const;
46  void GetAllPathesWhichContainHyperTermNo (size_t HyperTermNo, DwordVector& sub_pathes) const;
47  bool ReadPathFromString(const string& TextPath, vector<int>& HyperTermNos) const;
48  void GetAllPathesWhichStartFromThisSequence (const vector<int>& HyperTermNos, DwordVector& Result) const;
49  void GetAllLemmasWhosePathesStartFromThisSequence (const vector<int>& HyperTermNos, StringSet& Lemmas) const;
50  string GetAllThesInterpetations(const char* Lemma) const;
51 };
52 
53 extern const CDwdsThesaurus* LoadDwdsThesaurus();
54 extern void FreeDwdsThesaurus(const CDwdsThesaurus*);
55 
56 #endif
57 
58 /*--- emacs style variables ---
59  * Local Variables:
60  * mode: C++
61  * c-file-style: "ellemtel"
62  * c-basic-offset: 4
63  * tab-width: 8
64  * indent-tabs-mode: nil
65  * End:
66  */
vector< DWORD > DwordVector
Definition: utilit.h:148
vector< DWORD > Pathes
Definition: DwdsThesaurus.h:30
void GetAllLemmasWhosePathesStartFromThisSequence(const vector< int > &HyperTermNos, StringSet &Lemmas) const
Definition: DwdsThesaurus.cpp:258
CShortStringHolder LeavesLemmas
Definition: DwdsThesaurus.h:39
void FreeDwdsThesaurus(const CDwdsThesaurus *)
Definition: DwdsThesaurus.cpp:45
string GetAllThesInterpetations(const char *Lemma) const
Definition: DwdsThesaurus.cpp:67
bool LoadDwdsThesaurus()
Definition: DwdsThesaurus.cpp:111
DwordVector m_AllPathes
Definition: DwdsThesaurus.h:41
StringVector HyperTerms
Definition: DwdsThesaurus.h:28
void GetAllPathesWhichContainHyperTermNo(size_t HyperTermNo, DwordVector &sub_pathes) const
Definition: DwdsThesaurus.cpp:196
vector< string > StringVector
Definition: utilit.h:146
vector< DWORD > PathEndIndex
Definition: DwdsThesaurus.h:35
set< string > StringSet
Definition: utilit.h:147
vector< DWORD > LeavesPathes
Definition: DwdsThesaurus.h:38
Definition: DwdsThesaurus.h:25
int FindHyperTerm(const string &s) const
Definition: DwdsThesaurus.cpp:93
Definition: util_classes.h:50
void GetAllPathesWhichStartFromThisSequence(const vector< int > &HyperTermNos, DwordVector &Result) const
Definition: DwdsThesaurus.cpp:233
bool ReadPathFromString(const string &TextPath, vector< int > &HyperTermNos) const
Definition: DwdsThesaurus.cpp:216