FreeLing  4.0
Public Member Functions | Protected Attributes | Private Member Functions
freeling::automat< T > Class Template Reference

Abstract class to implement a Finite-State Automaton which is used by modules recognizing multiwords (dates, numbers, quantities, ...). More...

#include <automat.h>

Inheritance diagram for freeling::automat< T >:
Inheritance graph
[legend]
Collaboration diagram for freeling::automat< T >:
Collaboration graph
[legend]

List of all members.

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< intFinal
 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.

Detailed Description

template<class T>
class freeling::automat< T >

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


Constructor & Destructor Documentation

template<class T>
freeling::automat< T >::automat ( ) [inline]

Constructor.

template<class T>
virtual freeling::automat< T >::~automat ( ) [inline, virtual]

Destructor.


Member Function Documentation

template<class T>
void freeling::automat< T >::analyze ( sentence se) const [inline, virtual]

Detect patterns in sentence.

Implements freeling::processor.

Reimplemented in freeling::bioner.

template<class T>
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.

template<class T>
virtual int freeling::automat< T >::ComputeToken ( int  ,
sentence::iterator &  ,
sentence  
) const [private, pure virtual]
template<class T>
bool freeling::automat< T >::matching ( sentence se,
sentence::iterator &  i 
) const [inline]

Detect patterns starting at a specific word.

template<class T>
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.

template<class T>
virtual void freeling::automat< T >::SetMultiwordAnalysis ( sentence::iterator  ,
int  ,
const T *   
) const [private, pure virtual]
template<class T>
virtual void freeling::automat< T >::StateActions ( int  ,
int  ,
int  ,
sentence::const_iterator  ,
T *   
) const [private, pure virtual]
template<class T>
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.


Member Data Documentation

template<class T>
std::set<int> freeling::automat< T >::Final [protected]

set of final states

template<class T>
int freeling::automat< T >::initialState [protected]

state code of initial state

template<class T>
int freeling::automat< T >::stopState [protected]

state code for stop State

template<class T>
int freeling::automat< T >::trans[MAX_STATES][MAX_TOKENS] [protected]

Transition tables.


The documentation for this class was generated from the following file: