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


C++ CSentence::GetOpt方法代码示例

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


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

示例1: GetConjProperties

static int GetConjProperties(const CSentence& S, int WordNo, ConjFromWhatList& FromWhere,int& iConjIndex, int UpperBorder)
{
	if( (WordNo == -1) || (WordNo >= UpperBorder) )
		return -1;

	int OborotNo = S.m_Words[WordNo].GetOborotNo();

	if	(		OborotNo != -1 
			&& 	S.GetOpt()->m_pOborDic->m_Entries[OborotNo].HasPartOfSpeech(S.GetOpt()->m_Conjunction) 
		)
	{
		for(size_t i = WordNo ; i < UpperBorder; i++ )	
			if( S.m_Words[i].HasOborot2())
			{
				FromWhere = FROM_OBOR_DIC;
				iConjIndex = OborotNo;
				return WordNo + 1;
			}
	}

	iConjIndex = S.m_Words[WordNo].m_SubordinateConjNo;
	int HomonymNo;
	if	(		(iConjIndex != -1 )
			&&	!S.IsRelativSentencePronoun(0, WordNo, HomonymNo)
		)
	{
		FromWhere = FROM_SUB_CONJ;
		return WordNo+1;
	}

	return -1;
}
开发者ID:arcady-chugunov,项目名称:thesis,代码行数:32,代码来源:BuildInitialClauses.cpp

示例2: GetRelations

void GetRelations(const CSentence& Sentence, string& Result)
{
	CRelationsIterator RelIt;
	RelIt.SetSentence(&Sentence);
	for (int i = 0; i<Sentence.m_vectorPrClauseNo.size(); i++)
		RelIt.AddClauseNoAndVariantNo(Sentence.m_vectorPrClauseNo[i], 0);
	RelIt.BuildRelations();
	for (long RelNo = 0; RelNo < RelIt.GetRelations().size(); RelNo++)
	{
		const CSynOutputRelation& piRel = RelIt.GetRelations()[RelNo];
		string RelName = Sentence.GetOpt()->GetGroupNameByIndex(piRel.m_Relation.type);
		string Src = GetNodeStr(Sentence, RelIt, piRel.m_iSourceGroup, piRel.m_Relation.m_iFirstWord);
		string Trg = GetNodeStr(Sentence, RelIt, piRel.m_iTargetGroup, piRel.m_Relation.m_iLastWord);
		string SrcLemma, TrgLemma;
		string SrcGrm = GetNodeGrmStr(Sentence, RelIt, piRel.m_iSourceGroup, piRel.m_Relation.m_iFirstWord, SrcLemma);
		string TrgGrm = GetNodeGrmStr(Sentence, RelIt, piRel.m_iTargetGroup, piRel.m_Relation.m_iLastWord, TrgLemma);
		string GramRel = Sentence.GetOpt()->GetGramTab()->GrammemsToStr(piRel.m_Relation.m_iGrammems);

		Result += Format("\t<rel name=\"%s\" gramrel=\"%s\" lemmprnt=\"%s\" grmprnt=\"%s\" lemmchld=\"%s\" grmchld=\"%s\" > %s -> %s </rel>\n",
			RelName.c_str(), GramRel.c_str(), SrcLemma.c_str(), SrcGrm.c_str(), TrgLemma.c_str(), TrgGrm.c_str(), Src.c_str(), Trg.c_str());
	}
}
开发者ID:lord2894,项目名称:AOT-VS2012-13,代码行数:22,代码来源:TestSynan.cpp

示例3: GetNodeGrmStr

string GetNodeGrmStr(const CSentence& Sentence, const CRelationsIterator& RelIt, int GroupNo, int WordNo, string& Lemma)
{
	Lemma = "";
	if (GroupNo != -1)
		return "";
	else {
		size_t ClauseNo = Sentence.GetMinClauseByWordNo(WordNo);
		const CClause& Clause = Sentence.GetClause(ClauseNo);
		const CMorphVariant* pSynVar = &*Clause.GetSynVariantByNo(0);
		int UnitNo = pSynVar->UnitNoByWordNo(WordNo);
		const CSynUnit& U = pSynVar->m_SynUnits[UnitNo];
		Lemma = Sentence.GetWords()[WordNo].GetHomonym(U.m_iHomonymNum)->m_strLemma;
		return Sentence.GetOpt()->GetGramTab()->GrammemsToStr(U.m_iGrammems | U.m_TypeGrammems);
	}
}
开发者ID:lord2894,项目名称:AOT-VS2012-13,代码行数:15,代码来源:TestSynan.cpp

示例4: GetGroups

void GetGroups(const CSentence& Sentence, const CAgramtab& A, string& Res)
{
	int nClausesCount = Sentence.GetClausesCount();

	for (int ClauseNo = 0; ClauseNo<nClausesCount; ClauseNo++)
	{
		const CClause& Clause = Sentence.GetClause(ClauseNo);
		int nCvar = Clause.m_SynVariants.size();

		if (Clause.m_SynVariants.empty()) continue;

		int nVmax = Clause.m_SynVariants.begin()->m_iWeight;
		for (CSVI pSynVar = Clause.m_SynVariants.begin(); pSynVar != Clause.m_SynVariants.end(); pSynVar++)
		{
			if (pSynVar->m_iWeight < nVmax) break;

			const CMorphVariant& V = *pSynVar;
			Res += Format("\t<synvar>\n");

			// print the clause
			{
				int ClauseType = (V.m_ClauseTypeNo == -1) ? UnknownSyntaxElement : Clause.m_vectorTypes[V.m_ClauseTypeNo].m_Type;;
				string Type;
				if (ClauseType != UnknownSyntaxElement)
					Type = (const char*)A.GetClauseNameByType(ClauseType);
				else
					Type = "EMPTY";
				Res += Format("\t\t<clause type=\"%s\">%s</clause>\n", Type.c_str(), GetWords(Sentence, Clause).c_str());
			}


			for (int GroupNo = 0; GroupNo < V.m_vectorGroups.GetGroups().size(); GroupNo++)
			{
				const CGroup& G = V.m_vectorGroups.GetGroups()[GroupNo];
				Res += Format("\t\t<group type=\"%s\">%s</group>\n",
					Sentence.GetOpt()->GetGroupNameByIndex(G.m_GroupType),
					GetWords(Sentence, G).c_str());
			};
			Res += Format("\t</synvar>\n");
		}
	}


}
开发者ID:lord2894,项目名称:AOT-VS2012-13,代码行数:44,代码来源:TestSynan.cpp


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