48 Seq() :nLen(0),nMaxLen(0) {}
49 Seq(
int len) :nLen(0),nMaxLen(0) {
Reset(len); }
52 if (p_len > nMaxLen) {
55 for (
int i = 0; i <
nMaxLen; i++) {
74 void Set(
int *pInt,
int nLen,
Vocab *pv);
106 void Set(
const char *pstyle);
108 bool GetKey(
Seq &seq,
int nPos,
int nOrder,
Array<int> &key);
144 void Reset(
const char *pstyle);
154 void LoadFeat(
Seq &seq);
156 void IndexFeat(
int begIdx);
169 void ReadT(
File &file,
PValue *pValue = NULL);
185 Feat(
int nOrder = 0,
bool bClass =
true)
189 Reset(nOrder, bClass);
194 void Reset(
int nOrder,
bool bClass);
196 void Reset(
const char *pfeatType);
200 int GetNum()
const {
return m_nTotalNum; }
206 void FindClass(
Array<int> &afeat,
Seq &seq,
int pos,
int order);
208 void FindWord(
Array<int> &afeat,
Seq &seq,
int pos,
int order);
210 void FindPosDep(
Array<int> &afeat,
Seq &seq,
int pos,
int type = 0);
212 void LoadFeatFromCorpus(
const char *path,
Vocab *pv);
216 void ReadT(
File &file,
PValue *pValue = NULL);
char c
the charactor "w" or "c"
void Copy(Seq &seq)
copy the sequence
String m_style
using a string array to store the feature styles in this table, such as w2, w3,...
m WriteT(cfg_pathModelWrite)
int GetNum() const
get number
void SetClass(Vocab *pv)
set the class based the word sequence
void Random(Vocab *pv)
Random.
Analyse a determinate feat style (without ":")
Trie< VocabID, int > * m_ptrie
index all the features.
short n
number, "w[2]" then n=2
define the feature style. such as "w3"(word-3gram); "c2"(class-2gram);
int m_nMaxOrder
the ngram maximum order, including the skip distance
void Reset(int p_len)
reset only change the len variable, does not change the buffer size.
int m_nOrder
the total order of this style, including the skip distance
Array< int > m_aCutoff
cutoff setting for different order
define a sequence including the word sequence and class sequence
short i
if "w" then i=0, if "c" then i=1, used to index the value in Seq
int m_nTotalNum
total feature number
int GetNum() const
Get number.
Array< FeatTable * > m_aTable
different feature table
int m_nNum
the ngram number
FeatStyle(const char *pstyle)
int GetMinOrder() const
get minimum order
void Set(Array< int > &aInt, Vocab *pv)
transform the word sequence (form file) to Seq
const char * GetStyle() const
get style string
VocabID * GetClassSeq()
get class sequence
VocabID * GetWordSeq()
get word sequence
char * GetBuffer() const
get buffer
int nMaxLen
to denote the buffer size
void Copy(MatShell< T > &m)
Array< Array< int > * > m_aKey
define the key for each thread
include all the feature table
int m_nMinOrder
the ngram minimum order, including the skip distance
Array< Field > m_aFields
each field
int GetMaxOrder() const
get maxmum order
#define SAFE_DEL_POINTER_ARRAY(a)
Array< FeatStyle * > m_aStyleInfo
Feat(int nOrder=0, bool bClass=true)