LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
FsaAccessHeader.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 compactDict.h - description
8 -------------------
9 begin : mer mai 28 2003
10 copyright : (C) 2003 by Olivier Mesnard
11 email : olivier.mesnard@cea.fr
12 ***************************************************************************/
13
14/***************************************************************************
15 * *
16 * Compact dictionnary based on finite state automata implemented with *
17 * Boost Graph library. *
18 * Algorithm is described in article from Daciuk, Mihov, Watson & Watson: *
19 * "Incremental Construction of Minimal Acyclic Finite State Automata" *
20 * How to use it to compute hash code is explained in 'perfect hashing' *
21 * of document http://odur.let.rug.nl/alfa/fsa_stuff/#PerfHash *
22 * *
23 ***************************************************************************/
24
25#ifndef FSA_ACCESS_HEADER_H
26#define FSA_ACCESS_HEADER_H
27
28// From standard library
29#include <string>
31
32namespace Lima {
33namespace Common {
34namespace FsaAccess {
35
38
39#define MAGIC_NUMBER "limaFsaDict"
40#define HEADER_SIZE 1024
41// we autorize around 100 millions simple terms
42// higher ids are reserved to identify complex terms (compound words)
43#define MAX_SIMPLE_TID 100000000
44
45#define VERTEX_PROPERTY_16 uint64_t
46#define MAJOR_VERSION_16 2
47#define MINOR_VERSION_16 0
48
49class AbstractFsaAccessIStreamWrapper;
50class AbstractFsaAccessOStreamWrapper;
51
52class FsaAccessHeaderPrivate;
73 public:
74 FsaAccessHeader(bool trie_direction_fwd);
75 virtual ~FsaAccessHeader();
76 void read( AbstractFsaAccessIStreamWrapper& iw );
77 void write( AbstractFsaAccessOStreamWrapper& ow);
78 bool getTrieDirectionForward() const;
79 uint64_t getNbVertices() const;
80 uint64_t getNbEdges() const;
81 void setPackingStatus(uint8_t packingStatus);
82 void setNbVertices(uint64_t nbVerts);
83 void setNbEdges(uint64_t nbEdges);
84// uint64_t getMaxSimpleId() const;
85// uint64_t int getCompoundsDataOffset();
86// uint64_t getNbCompounds() const;
87// void setStreamPos(std::ifstream& is);
88// const long& getStreamPos();
89protected:
91 FsaAccessHeader& operator=(const FsaAccessHeader& h);
93};
94
95} // namespace FsaAccess
96} // namespace Common
97} // namespace Lima
98
99#endif //FSA_ACCESS_HEADER_H
#define LIMA_FSAACCESS_EXPORT
Definition LimaCommon.h:130
FsaDictionaries (FsaDictBuilder and FsaDictSpare) share the same binary file format:
NAUTITIA.