FreeLing
4.0
|
Class fex implements a feature extractor. More...
#include <fex.h>
Public Member Functions | |
fex (const std::wstring &, const std::wstring &, const std::map< std::wstring, const feature_function * > &) | |
constructor, given rule file, lexicon file (may be empty), and custom functions | |
~fex () | |
destructor | |
void | encode_name (sentence &, std::vector< std::set< std::wstring > > &) const |
encode given sentence in features as feature names. | |
void | encode_int (sentence &, std::vector< std::set< int > > &) const |
encode given sentence in features as integer feature codes | |
void | encode_all (sentence &, std::vector< std::set< std::wstring > > &, std::vector< std::set< int > > &) const |
encode given sentence in features as integer feature codes and as features names | |
std::vector< std::set < std::wstring > > | encode_name (sentence &) const |
encode given sentence in features as feature names. Return result suitable for Java/perl APIs | |
std::vector< std::set< int > > | encode_int (sentence &) const |
encode given sentence in features as integer feature codes. Return result apt for Java/perl APIs | |
void | clear_lexicon () |
clear lexicon | |
void | encode_to_lexicon (sentence &) |
encode sentence and add features to current lexicon | |
void | save_lexicon (const std::wstring &, double) const |
save lexicon to a file, filtering features with low occurrence rate | |
Private Member Functions | |
void | get_features (sentence &, std::vector< std::set< std::wstring > > &, std::vector< std::set< int > > &, int) const |
extract features from a sentence | |
void | read_condition (std::wistringstream &, const std::wstring &, const std::wstring &, std::list< fex_condition > &, int &) |
read rule conditions | |
void | precompute_once (const fex_rulepack &, sentence &) const |
Apply all rules in the pack once to each word in the sentence. | |
void | precompute_range (const fex_rulepack &, sentence &) const |
Apply all rules in the pack only to proper range around words matching pack condition. | |
Private Attributes | |
const tagset * | Tags |
tagset desription used to compute short versions of PoS tags | |
std::list< fex_rulepack > | packs |
rules used by the feature extractor | |
fex_lexicon | lex |
lexicon used to filter features. | |
std::map< std::wstring, std::set< std::wstring > > | set_files |
loaded set files (loaded once, may be used by several conditions in different rules) | |
const std::map< std::wstring, const feature_function * > & | feat_functs |
currently loaded specific feature extraction functions |
Class fex implements a feature extractor.
freeling::fex::fex | ( | const std::wstring & | , |
const std::wstring & | , | ||
const std::map< std::wstring, const feature_function * > & | |||
) |
constructor, given rule file, lexicon file (may be empty), and custom functions
destructor
void freeling::fex::clear_lexicon | ( | ) |
clear lexicon
void freeling::fex::encode_all | ( | sentence & | , |
std::vector< std::set< std::wstring > > & | , | ||
std::vector< std::set< int > > & | |||
) | const |
encode given sentence in features as integer feature codes and as features names
void freeling::fex::encode_int | ( | sentence & | , |
std::vector< std::set< int > > & | |||
) | const |
encode given sentence in features as integer feature codes
Referenced by freeling::bioner::analyze().
std::vector<std::set<int> > freeling::fex::encode_int | ( | sentence & | ) | const |
encode given sentence in features as integer feature codes. Return result apt for Java/perl APIs
void freeling::fex::encode_name | ( | sentence & | , |
std::vector< std::set< std::wstring > > & | |||
) | const |
encode given sentence in features as feature names.
std::vector<std::set<std::wstring> > freeling::fex::encode_name | ( | sentence & | ) | const |
encode given sentence in features as feature names. Return result suitable for Java/perl APIs
void freeling::fex::encode_to_lexicon | ( | sentence & | ) |
encode sentence and add features to current lexicon
void freeling::fex::get_features | ( | sentence & | , |
std::vector< std::set< std::wstring > > & | , | ||
std::vector< std::set< int > > & | , | ||
int | |||
) | const [private] |
extract features from a sentence
void freeling::fex::precompute_once | ( | const fex_rulepack & | , |
sentence & | |||
) | const [private] |
Apply all rules in the pack once to each word in the sentence.
void freeling::fex::precompute_range | ( | const fex_rulepack & | , |
sentence & | |||
) | const [private] |
Apply all rules in the pack only to proper range around words matching pack condition.
void freeling::fex::read_condition | ( | std::wistringstream & | , |
const std::wstring & | , | ||
const std::wstring & | , | ||
std::list< fex_condition > & | , | ||
int & | |||
) | [private] |
read rule conditions
void freeling::fex::save_lexicon | ( | const std::wstring & | , |
double | |||
) | const |
save lexicon to a file, filtering features with low occurrence rate
const std::map<std::wstring,const feature_function *>& freeling::fex::feat_functs [private] |
currently loaded specific feature extraction functions
fex_lexicon freeling::fex::lex [private] |
lexicon used to filter features.
std::list<fex_rulepack> freeling::fex::packs [private] |
rules used by the feature extractor
std::map<std::wstring, std::set<std::wstring> > freeling::fex::set_files [private] |
loaded set files (loaded once, may be used by several conditions in different rules)
const tagset* freeling::fex::Tags [private] |
tagset desription used to compute short versions of PoS tags