FreeLing
4.0
|
Abstract class to implement a Finite-State Automaton which is used by modules recognizing multiwords (dates, numbers, quantities, ...). More...
#include <automat.h>
Public Member Functions | |
automat () | |
Constructor. | |
virtual | ~automat () |
Destructor. | |
bool | matching (sentence &se, sentence::iterator &i) const |
Detect patterns starting at a specific word. | |
void | analyze (sentence &se) const |
Detect patterns in sentence. | |
Protected Attributes | |
int | initialState |
state code of initial state | |
int | stopState |
state code for stop State | |
int | trans [MAX_STATES][MAX_TOKENS] |
Transition tables. | |
std::set< int > | Final |
set of final states | |
Private Member Functions | |
virtual int | ComputeToken (int, sentence::iterator &, sentence &) const =0 |
pure virtual function to be provided by the child class. | |
virtual void | ResetActions (T *) const =0 |
pure virtual function to be provided by the child class . | |
virtual void | StateActions (int, int, int, sentence::const_iterator, T *) const =0 |
pure virtual function to be provided by the child class. | |
virtual void | SetMultiwordAnalysis (sentence::iterator, int, const T *) const =0 |
pure virtual function to be provided by the child class. | |
virtual bool | ValidMultiWord (const word &w, T *st) const |
virtual function (true by default). | |
virtual sentence::iterator | BuildMultiword (sentence &se, sentence::iterator start, sentence::iterator end, int fs, bool &built, T *st) const |
Private function to re-arrange sentence when match found. |
Abstract class to implement a Finite-State Automaton which is used by modules recognizing multiwords (dates, numbers, quantities, ...).
Details:
Child classes must provide a constructor that:
Child classes must provide the virtual functions:
Child classes must declare and manage any private attribute or function they may need to perform the expected computations
freeling::automat< T >::automat | ( | ) | [inline] |
Constructor.
virtual freeling::automat< T >::~automat | ( | ) | [inline, virtual] |
Destructor.
void freeling::automat< T >::analyze | ( | sentence & | se | ) | const [inline, virtual] |
virtual sentence::iterator freeling::automat< T >::BuildMultiword | ( | sentence & | se, |
sentence::iterator | start, | ||
sentence::iterator | end, | ||
int | fs, | ||
bool & | built, | ||
T * | st | ||
) | const [inline, private, virtual] |
Private function to re-arrange sentence when match found.
Reimplemented in freeling::ner_module.
virtual int freeling::automat< T >::ComputeToken | ( | int | , |
sentence::iterator & | , | ||
sentence & | |||
) | const [private, pure virtual] |
pure virtual function to be provided by the child class.
Computes token code for current word in current state.
Implemented in freeling::dates_cy, freeling::dates_de, freeling::dates_fr, freeling::dates_ru, freeling::numbers_de, freeling::dates_en, freeling::numbers_cs, freeling::numbers_ru, freeling::dates_pt, freeling::numbers_en, freeling::dates_gl, freeling::dates_ca, freeling::numbers_it, freeling::quantities_ru, freeling::dates_es, freeling::numbers_pt, freeling::quantities_en, freeling::dates_default, freeling::numbers_gl, freeling::quantities_pt, freeling::quantities_gl, freeling::numbers_ca, freeling::quantities_ca, freeling::numbers_es, freeling::quantities_es, freeling::numbers_default, freeling::quantities_default, freeling::locutions, freeling::ner_module, and freeling::np.
bool freeling::automat< T >::matching | ( | sentence & | se, |
sentence::iterator & | i | ||
) | const [inline] |
Detect patterns starting at a specific word.
virtual void freeling::automat< T >::ResetActions | ( | T * | ) | const [private, pure virtual] |
pure virtual function to be provided by the child class .
Resets automaton internal variables when a new search is started.
Implemented in freeling::numbers_it, freeling::dates_module, freeling::numbers_module, freeling::locutions, freeling::ner_module, freeling::np, and freeling::quantities_module.
virtual void freeling::automat< T >::SetMultiwordAnalysis | ( | sentence::iterator | , |
int | , | ||
const T * | |||
) | const [private, pure virtual] |
pure virtual function to be provided by the child class.
Sets analysis for pattern identified as a multiword.
Implemented in freeling::dates_cy, freeling::dates_de, freeling::dates_fr, freeling::dates_ru, freeling::numbers_de, freeling::dates_en, freeling::numbers_cs, freeling::numbers_ru, freeling::dates_pt, freeling::numbers_en, freeling::dates_gl, freeling::dates_ca, freeling::numbers_it, freeling::dates_es, freeling::numbers_pt, freeling::dates_default, freeling::numbers_gl, freeling::numbers_ca, freeling::numbers_es, freeling::numbers_default, freeling::ner_module, freeling::locutions, freeling::np, and freeling::quantities_module.
virtual void freeling::automat< T >::StateActions | ( | int | , |
int | , | ||
int | , | ||
sentence::const_iterator | , | ||
T * | |||
) | const [private, pure virtual] |
pure virtual function to be provided by the child class.
Performs appropriate internal actions, given origin and destinanation states, token code and word.
Implemented in freeling::dates_cy, freeling::dates_de, freeling::dates_fr, freeling::dates_ru, freeling::numbers_de, freeling::dates_en, freeling::numbers_cs, freeling::numbers_ru, freeling::dates_pt, freeling::numbers_en, freeling::dates_gl, freeling::dates_ca, freeling::numbers_it, freeling::quantities_ru, freeling::dates_es, freeling::numbers_pt, freeling::quantities_en, freeling::dates_default, freeling::numbers_gl, freeling::quantities_pt, freeling::quantities_gl, freeling::numbers_ca, freeling::quantities_ca, freeling::numbers_es, freeling::quantities_es, freeling::numbers_default, freeling::quantities_default, freeling::locutions, freeling::ner_module, and freeling::np.
virtual bool freeling::automat< T >::ValidMultiWord | ( | const word & | w, |
T * | st | ||
) | const [inline, private, virtual] |
virtual function (true by default).
Allows the child class to perform a last-minute check before effectively building the multiword.
Reimplemented in freeling::ner_module, and freeling::locutions.
std::set<int> freeling::automat< T >::Final [protected] |
set of final states
int freeling::automat< T >::initialState [protected] |
state code of initial state
int freeling::automat< T >::stopState [protected] |
state code for stop State
int freeling::automat< T >::trans[MAX_STATES][MAX_TOKENS] [protected] |
Transition tables.