LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
Automaton.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// NAUTITIA
7//
8// jys 22-JUL-2002
9//
10// State is the recovery point for automatons. State is a
11// collection of Transition and eventually inner automatons.
12// Inner automatons are called once when state is entered at
13// first time. Inner automatons are called before checking
14// transition. Inner automatons can return a status which
15// ccan be used by transitions.
16
17#ifndef LIMA_LINGUISTICPROCESSING_FLATTOKENIZER_AUTOMATON_H
18#define LIMA_LINGUISTICPROCESSING_FLATTOKENIZER_AUTOMATON_H
19
20#include "FlatTokenizerExport.h"
22#include "Text.h"
23#include "ReturnStatus.h"
24
25
26namespace Lima
27{
28namespace LinguisticProcessing
29{
30namespace FlatTokenizer
31{
32
33class State;
34
35#define FLATAUTOMATON_CLASSID "FlatAutomaton"
36
38{
39 Q_OBJECT
40
41public:
42 Automaton();
43 virtual ~Automaton();
44
45 // just define it for compatibility with AbstractResource
47 Manager*) override;
48
49
50 // Run-time. Returns true if a Transition was found open
51 const State* run(Text& text, const State* state = 0) const;
52
53 void loadFromFile(const std::string& fileName);
54
55 inline const std::vector<State*>& states() const {return m_states;};
56 inline std::vector<State*>& states() {return m_states;};
57
58 const State* stateNamed(const LimaString& name) const;
59 State* stateNamed(const LimaString& name);
60
61 inline const std::shared_ptr<CharChart> charChart() const {return m_charChart;}
62 inline void setCharChart(std::shared_ptr<CharChart> cc) {m_charChart = cc;}
63
64 inline void setStartState(const State* s) {m_startState = s;}
65private:
66 const State* m_startState;
67 std::vector<State*> m_states;
68 std::shared_ptr<CharChart> m_charChart;
69};
70
71} //namespace FlatTokenizer
72} // namespace LinguisticProcessing
73} // namespace Lima
74
75
76#endif
#define LIMA_FLATTOKENIZER_EXPORT
Manage initialization of InitializableObjects using configuration module and parameters.
const std::shared_ptr< CharChart > charChart() const
Definition Automaton.h:61
const std::vector< State * > & states() const
Definition Automaton.h:55
void setCharChart(std::shared_ptr< CharChart > cc)
Definition Automaton.h:62
int run(int aargc, char **aargv)
Definition main.cpp:31
NAUTITIA.
QString LimaString
Definition LimaString.h:33