FreeLing
4.0
|
Class locutions recognizes multiwords belonging to a list obtained from a configuration file. More...
#include <locutions.h>
Public Member Functions | |
locutions (const std::wstring &) | |
Constructor. | |
~locutions () | |
Destructor. | |
void | add_locution (const std::wstring &) |
Add a locution rule to the multiword recognizer. | |
void | set_OnlySelected (bool) |
Chancge behaviour of the module regarding to which analysis are considered when checking lemma & PoS patterns. | |
Private Member Functions | |
bool | check (const std::wstring &, std::set< std::wstring > &, bool &, bool &, locutions_status *) const |
Auxiliar for ComputeToken. | |
int | ComputeToken (int, sentence::iterator &, sentence &) const |
Compute the right token code for word j from given state. | |
void | ResetActions (locutions_status *) const |
Reset current multiword acumulator. | |
void | StateActions (int, int, int, sentence::const_iterator, locutions_status *) const |
Perform necessary actions in "state" reached from state "origin" via word j interpreted as code "token": Basically, when reaching a state, update accumulated multiword. | |
void | SetMultiwordAnalysis (sentence::iterator, int, const locutions_status *) const |
Set the appropriate lemma and tag for the new multiword. | |
bool | ValidMultiWord (const word &, locutions_status *pst=NULL) const |
Perform last minute validation before effectively building multiword. | |
Private Attributes | |
std::map< std::wstring, std::wstring > | locut |
store multiword list | |
std::set< std::wstring > | prefixes |
store multiword prefixes | |
tagset * | Tags |
Tagset handling modul. | |
bool | OnlySelected |
Whether to check all analysis for lemma and PoS conditions, or just selected ones. |
Class locutions recognizes multiwords belonging to a list obtained from a configuration file.
freeling::locutions::locutions | ( | const std::wstring & | locFile | ) |
Constructor.
Create a multiword recognizer, loading multiword file.
References freeling::util::absolute(), add_locution(), freeling::config_file::add_section(), freeling::config_file::close(), ERROR_CRASH, freeling::automat< locutions_status >::Final, freeling::config_file::get_content_line(), freeling::config_file::get_section(), freeling::automat< locutions_status >::initialState, MAX_STATES, MAX_TOKENS, OnlySelected, freeling::config_file::open(), ST_M, ST_P, ST_STOP, freeling::automat< locutions_status >::stopState, Tags, TK_mw, TK_mwL, TK_mwP, TK_pref, TK_prefL, TK_prefP, TRACE, and freeling::automat< locutions_status >::trans.
Destructor.
References Tags.
void freeling::locutions::add_locution | ( | const std::wstring & | line | ) |
Add a locution rule to the multiword recognizer.
References locut, and prefixes.
Referenced by locutions().
bool freeling::locutions::check | ( | const std::wstring & | , |
std::set< std::wstring > & | , | ||
bool & | , | ||
bool & | , | ||
locutions_status * | |||
) | const [private] |
Auxiliar for ComputeToken.
References locut, freeling::locutions_status::longest_mw, freeling::locutions_status::over_longest, prefixes, and TRACE.
Referenced by ComputeToken(), and ValidMultiWord().
int freeling::locutions::ComputeToken | ( | int | state, |
sentence::iterator & | j, | ||
sentence & | se | ||
) | const [private, virtual] |
Compute the right token code for word j from given state.
Implements freeling::automat< locutions_status >.
References freeling::locutions_status::acc_mw, check(), freeling::locutions_status::components, freeling::sentence::get_processing_status(), freeling::tagset::get_short_tag(), int2wstring, OnlySelected, freeling::locutions_status::over_longest, Tags, TK_mw, TK_other, TK_pref, and TRACE.
void freeling::locutions::ResetActions | ( | locutions_status * | st | ) | const [private, virtual] |
Reset current multiword acumulator.
Implements freeling::automat< locutions_status >.
References freeling::locutions_status::acc_mw, freeling::locutions_status::components, freeling::locutions_status::longest_mw, and freeling::locutions_status::mw_analysis.
void freeling::locutions::set_OnlySelected | ( | bool | b | ) |
Chancge behaviour of the module regarding to which analysis are considered when checking lemma & PoS patterns.
References OnlySelected.
void freeling::locutions::SetMultiwordAnalysis | ( | sentence::iterator | i, |
int | fstate, | ||
const locutions_status * | st | ||
) | const [private, virtual] |
Set the appropriate lemma and tag for the new multiword.
Implements freeling::automat< locutions_status >.
References freeling::locutions_status::mw_ambiguous, freeling::locutions_status::mw_analysis, and TRACE.
void freeling::locutions::StateActions | ( | int | origin, |
int | state, | ||
int | token, | ||
sentence::const_iterator | j, | ||
locutions_status * | st | ||
) | const [private, virtual] |
Perform necessary actions in "state" reached from state "origin" via word j interpreted as code "token": Basically, when reaching a state, update accumulated multiword.
Implements freeling::automat< locutions_status >.
References freeling::locutions_status::longest_mw, and TRACE.
bool freeling::locutions::ValidMultiWord | ( | const word & | w, |
locutions_status * | pst = NULL |
||
) | const [private, virtual] |
Perform last minute validation before effectively building multiword.
Reimplemented from freeling::automat< locutions_status >.
References check(), freeling::locutions_status::components, ERROR_CRASH, freeling::word::get_lc_form(), int2wstring, locut, freeling::locutions_status::longest_mw, freeling::locutions_status::mw_ambiguous, freeling::locutions_status::mw_analysis, freeling::locutions_status::over_longest, TRACE, wstring2int, and wstring2list.
std::map<std::wstring,std::wstring> freeling::locutions::locut [private] |
store multiword list
Referenced by add_locution(), check(), and ValidMultiWord().
bool freeling::locutions::OnlySelected [private] |
Whether to check all analysis for lemma and PoS conditions, or just selected ones.
Referenced by ComputeToken(), locutions(), and set_OnlySelected().
std::set<std::wstring> freeling::locutions::prefixes [private] |
store multiword prefixes
Referenced by add_locution(), and check().
tagset* freeling::locutions::Tags [private] |
Tagset handling modul.
Referenced by ComputeToken(), locutions(), and ~locutions().