当前位置: 首页>>代码示例>>C++>>正文


C++ CStateItem::StandardMove方法代码示例

本文整理汇总了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();
}
开发者ID:SUTDNLP,项目名称:ZPar,代码行数:28,代码来源:conparser.cpp

示例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);
    }
}
开发者ID:frcchang,项目名称:zpar,代码行数:41,代码来源:depparser.cpp


注:本文中的CStateItem::StandardMove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。