本文整理汇总了C++中CStateItem::StandardMove方法的典型用法代码示例。如果您正苦于以下问题:C++ CStateItem::StandardMove方法的具体用法?C++ CStateItem::StandardMove怎么用?C++ CStateItem::StandardMove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStateItem
的用法示例。
在下文中一共展示了CStateItem::StandardMove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: work
void CConParser::work(const CTwoStringVector &sentence, const CSentenceParsed &correct, CCoNLLOutput *o_conll){
const int length = sentence.size();
static int tmp_i,tmp_j;
static CAction correct_action;
m_lCache.clear();
m_lWordLen.clear();
for (tmp_i=0; tmp_i<length; tmp_i++ ) {
m_lCache.push_back( CTaggedWord<CTag, TAG_SEPARATOR>(sentence[tmp_i].first , sentence[tmp_i].second) );
m_lWordLen.push_back( getUTF8StringLength(sentence[tmp_i].first) );
}
std::vector<CStateItem> p(MAX_SENTENCE_SIZE*(2+UNARY_MOVES)+2);
CStateItem *correctState = &p[0];
//getLabeledBrackets(correct, correctState->gold_lb);
correctState->clear();
correctState->words = (&m_lCache);
tmp_i = 1;
while(true){
correctState->StandardMove(correct, correct_action);
//std::cerr<<correct_action<<std::endl;
correctState->Move(&p[tmp_i],correct_action);
correctState = &p[tmp_i];
tmp_i ++;
if (correctState == 0 || correctState->IsTerminated()) break; // while
}
correctState->GenerateStanford(sentence, o_conll);
p.clear();
}
示例2: GetOrUpdateStackScore
/*---------------------------------------------------------------
*
* extract_features - extract features from an example (counts
* recorded to parser model as weights)
*
*---------------------------------------------------------------*/
void
CDepParser::extract_features(const CDependencyParse &input) {
CStateItem item;
unsigned action;
CPackedScoreType<SCORE_TYPE, action::kMax> empty;
// word and pos
m_lCache.clear();
#ifdef LABELED
m_lCacheLabel.clear();
#endif
for (int i = 0; i < input.size(); ++ i) {
m_lCache.push_back(CTaggedWord<CTag, TAG_SEPARATOR>(input[i].word,
input[i].tag));
#ifdef LABELED
m_lCacheLabel.push_back(CDependencyLabel(input[i].label));
#endif
}
// make standard item
item.clear();
item.len_ = input.size();
for (int i = 0; i < input.size() * 2; ++ i) {
unsigned action = item.StandardMove(input
#ifdef LABELED
, m_lCacheLabel
#endif
);
GetOrUpdateStackScore(&item, empty, action, 1, 1);
item.Move(action);
}
}