TRF Language Model
trf::FeatTable Class Reference

define the feature style. such as "w3"(word-3gram); "c2"(class-2gram); More...

#include <trf-feature.h>

Public Member Functions

 FeatTable (const char *pstyle="")
 constructor More...
 
 ~FeatTable ()
 destructor More...
 
void Reset (const char *pstyle)
 Reset. More...
 
int GetNum () const
 get number More...
 
int GetMinOrder () const
 get minimum order More...
 
int GetMaxOrder () const
 get maxmum order More...
 
const char * GetStyle () const
 get style string More...
 
void LoadFeat (Seq &seq)
 Extract a feature from a sequence. More...
 
void IndexFeat (int begIdx)
 Set the number of each features. We should index the feature in defferent tables. More...
 
int CutoffFeat ()
 cutoff the features More...
 
void Find (Array< int > &afeat, Array< int > &key, bool bBeg, bool bEnd)
 Find the corresponding feature using a key. This will return the beg/end ngram. More...
 
void Find (Array< int > &afeat, Seq &seq, int pos, int order)
 Find the ngram feature with a fixed order. More...
 
void Find (Array< int > &afeat, Seq &seq)
 Find all the feature in the sequence. More...
 
void FindPosDep (Array< int > &afeat, Seq &seq, int pos)
 Find all the feature depending on position. More...
 
void ReadT (File &file, PValue *pValue=NULL)
 Read form file. More...
 
void WriteT (File &file, PValue *pValue=NULL)
 Write to file. More...
 

Public Attributes

String m_style
 using a string array to store the feature styles in this table, such as w2, w3,... More...
 
int m_nMinOrder
 the ngram minimum order, including the skip distance More...
 
int m_nMaxOrder
 the ngram maximum order, including the skip distance More...
 
int m_nNum
 the ngram number More...
 
Array< int > m_aCutoff
 cutoff setting for different order More...
 
Trie< VocabID, int > * m_ptrie
 index all the features. More...
 
Array< FeatStyle * > m_aStyleInfo
 
Array< Array< int > * > m_aKey
 define the key for each thread More...
 

Detailed Description

define the feature style. such as "w3"(word-3gram); "c2"(class-2gram);

Author
wangbin
Date
2015-12-10 using "w" denotes the word, "c" denote the class, "-" denote the skip, and "0-9" in "[]" denote the order different orders correspond to different template support the skip-gram, such as :
  1. "w[3]" (word-3gram); "c[2]" (class-2gram); "w[1:5]" (word ngram with order 1 to 5)
  2. "w[2]-[2]w[1]" (skip-word-3gram, ww–w);
  3. "w[2]-[1]c[2]" (skip-word-class-gram, ww–cc);
  4. "w[2]-[1:2]w[1]" (tried-skip-word-gram, ww [1:2] w);

Definition at line 124 of file trf-feature.h.

Constructor & Destructor Documentation

§ FeatTable()

trf::FeatTable::FeatTable ( const char *  pstyle = "")

constructor

Definition at line 112 of file trf-feature.cpp.

§ ~FeatTable()

trf::FeatTable::~FeatTable ( )

destructor

Definition at line 122 of file trf-feature.cpp.

Member Function Documentation

§ CutoffFeat()

int trf::FeatTable::CutoffFeat ( )

cutoff the features

Definition at line 209 of file trf-feature.cpp.

§ Find() [1/3]

void trf::FeatTable::Find ( Array< int > &  afeat,
Array< int > &  key,
bool  bBeg,
bool  bEnd 
)

Find the corresponding feature using a key. This will return the beg/end ngram.

Definition at line 268 of file trf-feature.cpp.

§ Find() [2/3]

void trf::FeatTable::Find ( Array< int > &  afeat,
Seq seq,
int  pos,
int  order 
)

Find the ngram feature with a fixed order.

Definition at line 293 of file trf-feature.cpp.

§ Find() [3/3]

void trf::FeatTable::Find ( Array< int > &  afeat,
Seq seq 
)

Find all the feature in the sequence.

Definition at line 306 of file trf-feature.cpp.

§ FindPosDep()

void trf::FeatTable::FindPosDep ( Array< int > &  afeat,
Seq seq,
int  pos 
)

Find all the feature depending on position.

Definition at line 320 of file trf-feature.cpp.

§ GetMaxOrder()

int trf::FeatTable::GetMaxOrder ( ) const
inline

get maxmum order

Definition at line 150 of file trf-feature.h.

§ GetMinOrder()

int trf::FeatTable::GetMinOrder ( ) const
inline

get minimum order

Definition at line 148 of file trf-feature.h.

§ GetNum()

int trf::FeatTable::GetNum ( ) const
inline

get number

Definition at line 146 of file trf-feature.h.

§ GetStyle()

const char* trf::FeatTable::GetStyle ( ) const
inline

get style string

Definition at line 152 of file trf-feature.h.

§ IndexFeat()

void trf::FeatTable::IndexFeat ( int  begIdx)

Set the number of each features. We should index the feature in defferent tables.

Definition at line 252 of file trf-feature.cpp.

§ LoadFeat()

void trf::FeatTable::LoadFeat ( Seq seq)

Extract a feature from a sequence.

Definition at line 172 of file trf-feature.cpp.

§ ReadT()

void trf::FeatTable::ReadT ( File file,
PValue pValue = NULL 
)

Read form file.

Definition at line 333 of file trf-feature.cpp.

§ Reset()

void trf::FeatTable::Reset ( const char *  pstyle)

Reset.

Definition at line 128 of file trf-feature.cpp.

§ WriteT()

void trf::FeatTable::WriteT ( File file,
PValue pValue = NULL 
)

Write to file.

Definition at line 360 of file trf-feature.cpp.

Member Data Documentation

§ m_aCutoff

Array<int> trf::FeatTable::m_aCutoff

cutoff setting for different order

Definition at line 131 of file trf-feature.h.

§ m_aKey

Array<Array<int> *> trf::FeatTable::m_aKey

define the key for each thread

Definition at line 136 of file trf-feature.h.

§ m_aStyleInfo

Array<FeatStyle*> trf::FeatTable::m_aStyleInfo

Definition at line 134 of file trf-feature.h.

§ m_nMaxOrder

int trf::FeatTable::m_nMaxOrder

the ngram maximum order, including the skip distance

Definition at line 129 of file trf-feature.h.

§ m_nMinOrder

int trf::FeatTable::m_nMinOrder

the ngram minimum order, including the skip distance

Definition at line 128 of file trf-feature.h.

§ m_nNum

int trf::FeatTable::m_nNum

the ngram number

Definition at line 130 of file trf-feature.h.

§ m_ptrie

Trie<VocabID, int>* trf::FeatTable::m_ptrie

index all the features.

Definition at line 132 of file trf-feature.h.

§ m_style

String trf::FeatTable::m_style

using a string array to store the feature styles in this table, such as w2, w3,...

Definition at line 127 of file trf-feature.h.


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