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


C++ PhraseAlignment::GetTarget方法代码示例

本文整理汇总了C++中PhraseAlignment::GetTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ PhraseAlignment::GetTarget方法的具体用法?C++ PhraseAlignment::GetTarget怎么用?C++ PhraseAlignment::GetTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhraseAlignment的用法示例。


在下文中一共展示了PhraseAlignment::GetTarget方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Compare

	int PhraseAlignment::Compare(const PhraseAlignment &other) const
	{
		if (this == &other) // comparing with itself
			return 0;

		if (GetTarget() != other.GetTarget()) 
			return ( GetTarget() < other.GetTarget() ) ? -1 : +1;

		if (GetSource() != other.GetSource())
			return ( GetSource() < other.GetSource() ) ? -1 : +1;

		if (!hierarchicalFlag) 
			return 0;

		// loop over all words (note: 0 = left hand side of rule)
		for(size_t i=0; i<phraseT.size()-1; i++) {
			if (isNonTerminal( vcbT.getWord( phraseT[i] ) )) {
				size_t thisAlign = *(alignedToT[i].begin());
				size_t otherAlign = *(other.alignedToT[i].begin());

				if (alignedToT[i].size() != 1 ||
					other.alignedToT[i].size() != 1 ||
					thisAlign != otherAlign)
				{
					int ret = (thisAlign < otherAlign) ? -1 : +1;
					return ret;
				}
			}
		}
		return 0;

	}
开发者ID:edwardgao,项目名称:mosesdecoder,代码行数:32,代码来源:PhraseAlignment.cpp

示例2: Compare

    int PhraseAlignment::Compare(const PhraseAlignment &other) const
    {
        if (this == &other) // comparing with itself
            return 0;

        if (GetTarget() != other.GetTarget()) //先比的是目标端
            return ( GetTarget() < other.GetTarget() ) ? -1 : +1;

        if (GetSource() != other.GetSource())
            return ( GetSource() < other.GetSource() ) ? -1 : +1;

        return 0;

    }
开发者ID:Kalep,项目名称:ctx-phrase,代码行数:14,代码来源:PhraseAlignment.cpp

示例3: equals

	// check if two word alignments between a phrase pair are the same
	bool PhraseAlignment::equals( const PhraseAlignment& other )
	{
		if (this == &other) return true;
		if (other.GetTarget() != GetTarget()) return false;
		if (other.GetSource() != GetSource()) return false;
		if (other.alignedToT != alignedToT) return false;
		if (other.alignedToS != alignedToS) return false;
		return true;
	}
开发者ID:edwardgao,项目名称:mosesdecoder,代码行数:10,代码来源:PhraseAlignment.cpp

示例4: match

	// check if two word alignments between a phrase pairs "match"
	// i.e. they do not differ in the alignment of non-termimals
	bool PhraseAlignment::match( const PhraseAlignment& other )
	{
		if (this == &other) return true;
		if (other.GetTarget() != GetTarget()) return false;
		if (other.GetSource() != GetSource()) return false;
		if (!hierarchicalFlag) return true;

		assert(phraseT.size() == alignedToT.size() + 1);
		assert(alignedToT.size() == other.alignedToT.size());

		// loop over all words (note: 0 = left hand side of rule)
		for(size_t i=0; i<phraseT.size()-1; i++) {
			if (isNonTerminal( vcbT.getWord( phraseT[i] ) )) {
				if (alignedToT[i].size() != 1 ||
					other.alignedToT[i].size() != 1 ||
					*(alignedToT[i].begin()) != *(other.alignedToT[i].begin()))
					return false;
			}
		}
		return true;
	}
开发者ID:edwardgao,项目名称:mosesdecoder,代码行数:23,代码来源:PhraseAlignment.cpp


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