22 StringsPoolIndex formId,
28 unsigned char* startEntryData,
29 unsigned char* endEntryData,
32 std::shared_ptr<Lima::Common::AbstractAccessByString> access,
36 m_startEntryData(startEntryData),
37 m_endEntryData(endEntryData),
39 m_notMainKeysHandler(0),
43 LDEBUG <<
"EnhancedAnalysisDictionaryEntry::EnhancedAnalysisDictionaryEntry"
53 m_startEntryData(eade.m_startEntryData),
54 m_endEntryData(eade.m_endEntryData),
55 m_dicoData(eade.m_dicoData),
56 m_notMainKeysHandler(0)
58 if (eade.m_notMainKeysHandler) {
59 m_notMainKeysHandler=new NotMainKeysDictionaryEntryHandler(*(eade.m_notMainKeysHandler));
65 if (m_notMainKeysHandler) {
66 delete m_notMainKeysHandler;
67 m_notMainKeysHandler=0;
74 auto handler = targetHandler;
75 if (m_notMainKeysHandler)
77 m_notMainKeysHandler->setDelegate(targetHandler);
78 handler = m_notMainKeysHandler;
81 parseLingInfos(m_startEntryData, m_endEntryData, m_dicoData, handler);
88 auto handler = targetHandler;
89 if (m_notMainKeysHandler) {
90 m_notMainKeysHandler->setDelegate(targetHandler);
91 handler = m_notMainKeysHandler;
103 LDEBUG <<
"EnhancedAnalysisDictionaryEntry::parseAccentedForms";
105 auto handler = targetHandler;
106 if (m_notMainKeysHandler) {
107 m_notMainKeysHandler->setDelegate(targetHandler);
108 handler = m_notMainKeysHandler;
111 unsigned char* p=m_startEntryData;
112 assert(p != m_endEntryData);
116 if (p != m_endEntryData)
120 unsigned char* end=p+read;
124 if (read ==
static_cast<StringsPoolIndex
>(0))
127 handler->deleteAccentedForm(read);
132 LDEBUG <<
" found accented form:" << (*m_stringsPool)[read];
134 handler->foundAccentedForm(read);
136 unsigned char* acc=m_dicoData->getEntryAddr(read);
141 LWARN <<
"WARNING ! should never accentuate to a delete entry !";
148 LWARN <<
"WARNING ! should never accentuate to an empty entry !";
152 handler->endAccentedForm();
160 unsigned char* startEntry,
161 unsigned char* endEntry,
169 LDEBUG <<
"EnhancedAnalysisDictionaryEntry::parseLingInfos : "
170 << (uint64_t)startEntry <<
" , " << (uint64_t)endEntry;
173 unsigned char* p = startEntry;
174 assert(p != endEntry);
177 LDEBUG <<
"read linginfo length = " << read;
179 unsigned char* end = p + read;
181 LDEBUG <<
"end = " << (uint64_t)(end);
186 LDEBUG <<
"read linginfo p = " << (uint64_t)p;
188 bool toDelete =
false;
191 if (lemma ==
static_cast<StringsPoolIndex
>(0))
194 LDEBUG <<
"read delete flag (p =" << (uint64_t)p <<
")";
200 LDEBUG <<
"read lemma " << lemma <<
" (p =" << (uint64_t)p <<
")";
203 if (norm ==
static_cast<StringsPoolIndex
>(0))
208 LDEBUG <<
"read norm " << norm <<
" (p =" << (uint64_t)p <<
")" ;
216 LDEBUG <<
"read lingOffset = " << lingOffset <<
" (p =" << (uint64_t)p <<
")";
224 auto propsEnd = props + read;
225 while (props != propsEnd)
235 unsigned char* startEntry,
236 unsigned char* endEntry,
244 unsigned char* p=startEntry;
245 assert(p != endEntry);
260 unsigned char* end=p+read;
270 handler->deleteConcatenated();
283 handler->foundComponent(pos,len,str);
286 unsigned char* pp_end=pp+lilength;
295 handler->endConcatenated();
302 uint64_t nbComponents=read;
305 handler->foundConcatenated();
306 while (nbComponents-- > 0)
316 handler->foundComponent(pos,len,str);
317 unsigned char* liend=p+lilength;
324 if (norm ==
static_cast<StringsPoolIndex
>(0))
328 handler->foundLingInfos(lemma,norm);
331 unsigned char* props = dicoData->getLingPropertiesAddr(lingOffset);
334 unsigned char* propsEnd = props + read;
335 while (props!=propsEnd)
339 handler->endLingInfos();
341 handler->endComponent();
343 handler->endConcatenated();
352 StringsPoolIndex splemma=(*m_sp)[m_access->getSpelling(lemma)];
353 StringsPoolIndex spnorm=splemma;
355 spnorm=(*m_sp)[m_access->getSpelling(norm)];
357 m_delegate->foundLingInfos(splemma,spnorm);
361 StringsPoolIndex norm)
363 auto splemma=(*m_sp)[m_access->getSpelling(lemma)];
367 spnorm=(*m_sp)[m_access->getSpelling(norm)];
369 m_delegate->deleteLingInfos(splemma,spnorm);
#define ANALYSISDICTLOGINIT
static LinguisticCode decodeFromBinary(std::istream &is)
virtual void endLingInfos()
virtual void foundProperties(LinguisticCode lings)
virtual void deleteLingInfos(StringsPoolIndex lemma, StringsPoolIndex norm)
virtual void startEntry(StringsPoolIndex form)
virtual void foundLingInfos(StringsPoolIndex lemma, StringsPoolIndex norm)
bool hasConcatenated() const
bool hasLingInfos() const
StringsPoolIndex m_entryId
AbstractDictionaryEntry(StringsPoolIndex entryId, bool isFinal, bool isEmpty, bool hasLingInfos, bool hasConcatenated, bool hasAccentedForm)
unsigned char * getLingPropertiesAddr(uint64_t index) const
static uint64_t readCodedInt(unsigned char *&p)
virtual void parseAccentedForms(AbstractDictionaryEntryHandler *handler) const override
virtual void parseLingInfos(AbstractDictionaryEntryHandler *handler) const override
virtual ~EnhancedAnalysisDictionaryEntry()
EnhancedAnalysisDictionaryEntry(StringsPoolIndex formId, bool isFinal, bool isEmpty, bool hasLingInfos, bool hasConcatenated, bool hasAccentedForm, unsigned char *startEntryData, unsigned char *endEntryData, const DictionaryData *dicoData, bool isMainKeys, std::shared_ptr< Lima::Common::AbstractAccessByString > access, Lima::FsaStringsPool *sp)
virtual void parseConcatenated(AbstractDictionaryEntryHandler *handler) const override
DictionaryEntryHandler used to convert dico ids into stringPool ids when dictionary keys are differen...
void deleteLingInfos(StringsPoolIndex lemma, StringsPoolIndex norm) override
void foundLingInfos(StringsPoolIndex lemma, StringsPoolIndex norm) override