コード例 #1
0
char * GetNumberStr (BigNumber *bn) {
  char * str;
  str = (char *) malloc (sizeof(char)*(bn->length+1)*BN_DIGITS);
  str[0] = 0;
  GetNodeStr(bn->head, str);
  return str;
}
コード例 #2
0
void GetNodeStr (BigNumberNode *node, char *str) {
  if (node->prox != 0) {
    GetNodeStr(node->prox, str);
    sprintf(str + strlen(str), "%06d", node->value);
  } else {
    sprintf(str + strlen(str), "%d", node->value);
  }
}
コード例 #3
0
ファイル: TestSynan.cpp プロジェクト: lord2894/AOT-VS2012-13
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());
	}
}