LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
EnhancedAnalysisDictionaryEntry.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/***************************************************************************
7 * Copyright (C) 2004-2012 by CEA LIST *
8 * *
9 ***************************************************************************/
10#ifndef LIMA_LINGUISTICPROCESSING_ANALYSISDICTENHANCEDANALYSISDICTIONARYENTRY_H
11#define LIMA_LINGUISTICPROCESSING_ANALYSISDICTENHANCEDANALYSISDICTIONARYENTRY_H
12
13#include "AnalysisDictExport.h"
14#include "DictionaryData.h"
17
18namespace Lima
19{
20
21namespace LinguisticProcessing
22{
23
24namespace AnalysisDict
25{
26
27// forward declaration
28class NotMainKeysDictionaryEntryHandler;
29
34{
35public:
37 StringsPoolIndex formId,
38 bool isFinal,
39 bool isEmpty,
40 bool hasLingInfos,
41 bool hasConcatenated,
42 bool hasAccentedForm,
43 unsigned char* startEntryData,
44 unsigned char* endEntryData,
45 const DictionaryData* dicoData,
46 bool isMainKeys,
47 std::shared_ptr<Lima::Common::AbstractAccessByString> access,
49 );
52
53 virtual AbstractDictionaryEntry* clone() override;
54 virtual void parseLingInfos(AbstractDictionaryEntryHandler* handler) const override;
55 virtual void parseConcatenated(AbstractDictionaryEntryHandler* handler) const override;
56 virtual void parseAccentedForms(AbstractDictionaryEntryHandler* handler) const override;
57
58private:
59 static void parseLingInfos(unsigned char* startEntry,unsigned char* endEntry,const DictionaryData* dicoData,AbstractDictionaryEntryHandler* handler);
60 static void parseConcatenated(unsigned char* startEntry,unsigned char* endEntry,const DictionaryData* dicoData,AbstractDictionaryEntryHandler* handler);
61
62 unsigned char* m_startEntryData;
63 unsigned char* m_endEntryData;
64 const DictionaryData* m_dicoData;
65 NotMainKeysDictionaryEntryHandler* m_notMainKeysHandler;
66 Lima::FsaStringsPool* m_stringsPool;
67};
68
73
79{
80public:
81
83 std::shared_ptr<Lima::Common::AbstractAccessByString> access,
85 m_access(access),
86 m_sp(sp) {}
87
89
90 void setDelegate(AbstractDictionaryEntryHandler* delegate);
91
92 void startEntry(StringsPoolIndex form) override;
93 void endEntry() override;
94
95 void foundLingInfos(StringsPoolIndex lemma,StringsPoolIndex norm) override;
96 void deleteLingInfos(StringsPoolIndex lemma,StringsPoolIndex norm) override;
97 void endLingInfos() override;
98
99 void foundConcatenated() override;
100 void deleteConcatenated() override;
101 void foundComponent(uint64_t position, uint64_t length,StringsPoolIndex form) override;
102 void endComponent() override;
103 void endConcatenated() override;
104
105 void foundAccentedForm(StringsPoolIndex form) override;
106 void deleteAccentedForm(StringsPoolIndex form) override;
107 void endAccentedForm() override;
108
109 void foundProperties(LinguisticCode lings) override;
110
111private:
112 std::shared_ptr<Lima::Common::AbstractAccessByString> m_access;
115};
116
118{
119 m_delegate=delegate;
120}
121
122inline void NotMainKeysDictionaryEntryHandler::startEntry(StringsPoolIndex form)
123{
124 m_delegate->startEntry((*m_sp)[m_access->getSpelling(form)]);
125// This hack fix bug 1630 but introduce regression in HyperwordStemmer
126// m_delegate->startEntry(form);
127}
128
130{
131 m_delegate->endEntry();
132}
133
134
136{
137 m_delegate->endLingInfos();
138}
139
144
149
150inline void NotMainKeysDictionaryEntryHandler::foundComponent(uint64_t position, uint64_t length,StringsPoolIndex form)
151{
152 m_delegate->foundComponent(position,length,(*m_sp)[m_access->getSpelling(form)]);
153// This hack fix bug 1630 but introduce regression in HyperwordStemmer
154// m_delegate->foundComponent(position,length,form);
155}
156
158{
159 m_delegate->endComponent();
160}
161
166
168{
169 m_delegate->foundAccentedForm((*m_sp)[m_access->getSpelling(form)]);
170// This hack fix bug 1630 but introduce regression in HyperwordStemmer
171// m_delegate->foundAccentedForm(form);
172}
173
175{
176 m_delegate->deleteAccentedForm((*m_sp)[m_access->getSpelling(form)]);
177// This hack fix bug 1630 but introduce regression in HyperwordStemmer
178// m_delegate->deleteAccentedForm(form);
179}
180
185
187{
188 m_delegate->foundProperties(lings);
189}
190
191
192}
193
194}
195
196}
197
198#endif
#define LIMA_ANALYSISDICT_EXPORT
virtual void foundComponent(uint64_t position, uint64_t length, StringsPoolIndex form)
DictionaryEntryHandler used to convert dico ids into stringPool ids when dictionary keys are differen...
void foundComponent(uint64_t position, uint64_t length, StringsPoolIndex form) override
NotMainKeysDictionaryEntryHandler(std::shared_ptr< Lima::Common::AbstractAccessByString > access, Lima::FsaStringsPool *sp)
void parseConcatenated(std::vector< ConcatenatedLevelState > &data, Lima::FsaStringsPool *sp, AbstractDictionaryEntryHandler *handler)
void parseLingInfos(std::vector< LingInfoLevelState > &data, Lima::FsaStringsPool *sp, AbstractDictionaryEntryHandler *handler)
NAUTITIA.