LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
lexiconIdGenerator.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) 2003 by CEA *
8 * author Olivier MESNARD olivier.mesnard@cea.fr *
9 * *
10 * lexiconIdGenerator.h - description *
11 * LexiconIdGenerator = base class for concrete IdGenerator *
12 * implements getId() *
13 * handles composed word and rely on SimpleStringAccess for simple word *
14 * uses std::map<DepCompound,id> to store compounds. *
15 * SimpleStringAccess can be either FsaAccesSpare16 or a map *
16 ***************************************************************************/
17#ifndef FSA_LEXICON_ID_GENERATOR_H
18#define FSA_LEXICON_ID_GENERATOR_H
19
23
24#include <map>
25#include "common/LimaCommon.h"
26// #include "index/common/LimaString.h"
28
29namespace Lima {
30namespace Common {
31namespace FsaAccess {
32
33
34typedef std::map<DepCompound, uint64_t, DepCompoundLtOp> DepCompoundLinksM;
35typedef std::map<ExtCompound, uint64_t, ExtCompoundLtOp> ExtCompoundLinksM;
36
37// default functor class usefull to inform client of AbstractLexiconIdGenerator
38// of links created by getId(const std::vector<uint64_t>& structure )
40 int operator() ( uint64_t cmp1, uint64_t cmp2, uint64_t newId);
41};
42
43template<typename SimpleStringAccess>
45{
46 public:
49
50 uint64_t getSize() const override;
51 uint64_t getSimpleTermSize() const override;
52 void print(std::ostream& os) const;
53 // implementation of operation inherited from interface IndexElementIdAccessor
54 uint64_t getId(const Lima::LimaString& word) const;
55 uint64_t getId(const std::vector<uint64_t>& structure) const;
56 // implementation of operation inherited from interface IndexElementIdGenerator
57// uint64_t getId(const LimaString& word);
58 uint64_t getId(const Lima::LimaString & word) override;
59 uint64_t getId( const std::vector<uint64_t>& structure ) override;
61 // output of compound words data
63 uint64_t getNextDepData(char* buff);
64 uint64_t getNextExtData(char* buff);
66 void read(FsaAccessDataInputHandler& inputHandler);
67 void feedWithNextDepData( const char* buff, uint64_t buffSize );
68 void feedWithNextExtData( const char* buff, uint64_t buffSize);
69
70 protected:
71 SimpleStringAccess m_simpleWords;
74 private:
75 // for getNextDepData() and getNextExtData() operation
76 ExtCompoundLinksM::const_iterator m_extIt;
77 DepCompoundLinksM::const_iterator m_depIt;
78 //char* m_buffer;
79 static const uint64_t BUFFER_SIZE;
80};
81
82} // namespace FsaAccess
83} // namespace Common
84} // namespace Lima
85
86#include "lexiconIdGenerator.tcc"
87
88#endif //FSA_LEXICON_ID_GENERATOR_H
uint64_t getId(const std::vector< uint64_t > &structure) const
uint64_t getId(const std::vector< uint64_t > &structure) override
void feedWithNextDepData(const char *buff, uint64_t buffSize)
void print(std::ostream &os) const
uint64_t getSimpleTermSize() const override
void write(Lima::Common::FsaAccess::FsaAccessDataOutputHandler &outputHandler)
uint64_t getId(const Lima::LimaString &word) override
void read(FsaAccessDataInputHandler &inputHandler)
void feedWithNextExtData(const char *buff, uint64_t buffSize)
uint64_t getId(const Lima::LimaString &word) const
LexiconIdGenerator(AbstractLexiconIdGeneratorInformer *informer)
std::map< ExtCompound, uint64_t, ExtCompoundLtOp > ExtCompoundLinksM
std::map< DepCompound, uint64_t, DepCompoundLtOp > DepCompoundLinksM
NAUTITIA.
QString LimaString
Definition LimaString.h:33