FreeLing  3.0
Public Member Functions | Private Member Functions | Private Attributes
fex Class Reference

Class fex implements a feature extractor. More...

#include <fex.h>

Collaboration diagram for fex:
Collaboration graph
[legend]

List of all members.

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
void encode_name (const sentence &, std::vector< std::set< std::wstring > > &)
 encode given sentence in features as feature names.
void encode_int (const sentence &, std::vector< std::set< int > > &)
 encode given sentence in features as integer feature codes
void encode_all (const sentence &, std::vector< std::set< std::wstring > > &, std::vector< std::set< int > > &)
 encode given sentence in features as integer feature codes and as features names
std::vector< std::set
< std::wstring > > 
encode_name (const sentence &)
 encode given sentence in features as feature names. Return result apt for Java/perl APIs
std::vector< std::set< int > > encode_int (const sentence &)
 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 (const 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 (const sentence &, std::vector< std::set< std::wstring > > &, std::vector< std::set< int > > &, int)
 extract features from a sentence
void read_condition (std::wistringstream &, const std::wstring &, std::list< fex_condition > &, int &)
 read rule conditions
void precompute_once (fex_rulepack &, const sentence &)
 Apply all rules in the pack once to each word in the sentence.
void precompute_range (fex_rulepack &, const sentence &)
 Apply all rules in the pack only to proper range around words matching pack condition.

Private Attributes

std::list< fex_rulepackpacks
 rules used by the feature extractor
fex_lexicon lex
 lexicon used to filter features.

Detailed Description

Class fex implements a feature extractor.


Constructor & Destructor Documentation

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


Member Function Documentation

clear lexicon

void fex::encode_all ( const sentence ,
std::vector< std::set< std::wstring > > &  ,
std::vector< std::set< int > > &   
)

encode given sentence in features as integer feature codes and as features names

void fex::encode_int ( const sentence ,
std::vector< std::set< int > > &   
)

encode given sentence in features as integer feature codes

Referenced by bioner::analyze().

std::vector<std::set<int> > fex::encode_int ( const sentence )

encode given sentence in features as integer feature codes. Return result apt for Java/perl APIs

void fex::encode_name ( const sentence ,
std::vector< std::set< std::wstring > > &   
)

encode given sentence in features as feature names.

std::vector<std::set<std::wstring> > fex::encode_name ( const sentence )

encode given sentence in features as feature names. Return result apt for Java/perl APIs

void fex::encode_to_lexicon ( const sentence )

encode sentence and add features to current lexicon

void fex::get_features ( const sentence ,
std::vector< std::set< std::wstring > > &  ,
std::vector< std::set< int > > &  ,
int   
) [private]

extract features from a sentence

void fex::precompute_once ( fex_rulepack ,
const sentence  
) [private]

Apply all rules in the pack once to each word in the sentence.

void fex::precompute_range ( fex_rulepack ,
const sentence  
) [private]

Apply all rules in the pack only to proper range around words matching pack condition.

void fex::read_condition ( std::wistringstream &  ,
const std::wstring &  ,
std::list< fex_condition > &  ,
int &   
) [private]

read rule conditions

void fex::save_lexicon ( const std::wstring &  ,
double   
) const

save lexicon to a file, filtering features with low occurrence rate


Member Data Documentation

fex_lexicon fex::lex [private]

lexicon used to filter features.

std::list<fex_rulepack> fex::packs [private]

rules used by the feature extractor


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