LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
FsaAccessBuilder16.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 FsaAccessBuilder16.h - description
8 -------------------
9 begin : mar mai 27 2003
10 copyright : (C) 2003 by Olivier Mesnard
11 email : olivier.mesnard@cea.fr
12 ***************************************************************************/
13
14/***************************************************************************
15 * Copyright (C) 2003 by CEA *
16 * author Olivier MESNARD olivier.mesnard@cea.fr *
17 * *
18 * Compact dictionnary based on finite state automata implemented with *
19 * Boost Graph library. *
20 * Algorithm is described in article from Daciuk, Mihov, Watson & Watson: *
21 * "Incremental Construction of Minimal Acyclic Finite State Automata" *
22 ***************************************************************************/
23#ifndef COMPACT_DICT_FSA_DICT_BUILDER16_HPP
24#define COMPACT_DICT_FSA_DICT_BUILDER16_HPP
25
26#include <vector>
27#include <boost/config.hpp>
28#include <boost/graph/adjacency_list.hpp>
29#include <boost/graph/adjacency_list.hpp>
30
32
33namespace Lima {
34namespace Common {
35namespace FsaAccess {
36
37class LIMA_FSAACCESS_EXPORT FsaAccessBuilder16: public FsaAccess16<selected_graph_types16::builderGraphType> {
38 // type of graph
40
41 typedef boost::graph_traits<graphType>::vertex_descriptor dicoVertex;
42 typedef boost::graph_traits<graphType>::edge_descriptor dicoEdge;
43 typedef boost::graph_traits<graphType>::degree_size_type dico_degree_size;
44
45 public:
46 FsaAccessBuilder16( bool trie_direction_fwd = true );
47 virtual ~FsaAccessBuilder16();
48
49 // For IO
50 FsaAccessIOHandler<graphType>* getFsaAccessIOHandler() const override;
51
52 virtual void addWord( const Lima::LimaString & newWord );
53 void write( const std::string & filename );
54 void write( std::ostream &os );
55 void write( FsaAccessDataOutputHandler &oh );
56 void pack();
57 protected:
58 void write( AbstractFsaAccessOStreamWrapper &ow );
59 virtual void replaceOrRegister( dicoVertex candidateState );
60 void merge( dicoVertex inRegister, dicoVertex tempState, dicoVertex parentState );
61 private:
62 dict_packing_type m_packingStatus;
63};
64
65
66} // namespace compactDict
67} // namespace Common
68} // namespace Lima
69
70#endif //COMPACT_DICT_FSA_DICT_BUILDER16_HPP
#define LIMA_FSAACCESS_EXPORT
Definition LimaCommon.h:130
NAUTITIA.
QString LimaString
Definition LimaString.h:33
boost::adjacency_list< boost::vecS, boost::listS, boost::bidirectionalS, dicoVertexCountProperty > builderGraphType
Graph used for FsaDictBuilder container types are chosen for their efficiency in insertion bidirectio...