string CEngSemStructure::GetPrep(const TCortege& cortege, DictTypeEnum type) { int iNum = 0; string strPrep; strPrep.erase(); if( cortege.m_DomItemNos[0] == -1 ) return strPrep; string str = GetItemStr(cortege.m_DomItemNos[0], type); if( (iNum = str.find("+")) != -1 ) { strPrep = str.substr(0, iNum); } else if( cortege.m_DomItemNos[1] != -1 ) { str = GetItemStr(cortege.m_DomItemNos[1], type); if( (iNum = str.find("+")) != -1 ) strPrep = str.substr(0, iNum); } return strPrep; }
EGramCortegeType CEngSemStructure::GetGramCortegeType(TCortege& cortege, DictTypeEnum type) { if( cortege.m_DomItemNos[0] == -1 ) return UnknownGram; string gram_str = GetItemStr(cortege.m_DomItemNos[0], type); EGramCortegeType CortegeType = GetGramCortegeType(gram_str); if( CortegeType == UnknownGram) { if( cortege.m_DomItemNos[1] != -1 ) { gram_str = GetItemStr(cortege.m_DomItemNos[1], type); CortegeType = GetGramCortegeType(gram_str); } } return CortegeType; }
//得到参数对应的某个项的内容,以字符串形式取出,nPos从零开始,不成功则返回false bool CScript::GetItemData(CTString strParamName, int nPos,CTString &Value) { CTString strLine = GetLineByParamName(strParamName); GetItem(strLine,m_tempArray); if (nPos<0 || nPos>=m_tempArray.GetSize()) return false; CTString strItem = GetItemStr(strLine); sItem *psItem = (sItem *)m_tempArray.GetAt(nPos); Value = strItem.Mid(psItem->nFirstPos, psItem->nLastPos - psItem->nFirstPos + 1) ; return true; }
int CEngSemStructure::NumPrepPhr(const vector<TCortege>& GramCorteges, DictTypeEnum type) { if( type == NoneRoss) return false; for( int i=0; i<GramCorteges.size(); i++ ) { const TCortege& cortege = GramCorteges[i]; if( (GetItemStr(cortege.m_DomItemNos[0], type) == "PREP_PHR") && (cortege.m_DomItemNos[1] == -1) ) return i; } return -1; }
bool CEngSemStructure::HasNeg(long UnitNo, DictTypeEnum type ) { if( (UnitNo == ErrUnitNo) || (type == NoneRoss ) ) return false; vector<TCortege> corteges; GetRossHolder(type)->GetFieldValues(string("GF"),UnitNo,corteges); bool bFound = false; if( corteges.size() == 0) return false; int i = 0; while( corteges[0].m_DomItemNos[i] != -1 ) { string strVal = GetItemStr(corteges[0].m_DomItemNos[i],type); if( strVal.find("Neg") != string::npos ) return true; i++; } return false; }