int CWord::PutAuxArticle(int iH, const SDictIndex& dicIndex, bool bCloneAnyWay) { CHomonym& h = GetRusHomonym(iH); bool has_gzt = dicIndex.m_DicType == KW_DICT && h.HasGztArticle(); if (has_gzt || h.m_DicIndexes[dicIndex.m_DicType] != -1) { TKeyWordType kwType = GlobalGramInfo->GetAuxKWType(dicIndex); if (!bCloneAnyWay && !has_gzt && GlobalGramInfo->HasArticle(h, SArtPointer(kwType), KW_DICT)) { h.m_KWtype2Articles[kwType].push_back(dicIndex); return iH; } else { THomonymPtr pNewHom = h.Clone(); pNewHom->PutAuxArticle(dicIndex); return AddRusHomonym(pNewHom); } } else { h.PutAuxArticle(dicIndex); return iH; } }
// return found (or newly made) homonym id static int FindOrMakeMultiwordHomonym(const CWordSequence& ws, CWord& word, TKeyWordType kwtype, THomonymGrammems grammems, THomonymPtr& res) { // use the content of CWordSequence.m_Lemmas as new homonym lemma Wtroka str = ws.GetLemma(); if (!str) str = word.GetLowerText(); TMorph::ToLower(str); int homId = -1; // search if we already have a multiword homonym with such text if (!FindBestHomonym(word, str, kwtype, grammems, homId)) { // create new homonym, if there is no ready one res = new CHomonym(TMorph::GetMainLanguage(), str); if (ws.HasAuxArticle()) res->PutAuxArticle(ws.GetAuxArticleIndex()); else res->PutGztArticle(ws.GetGztArticle()); homId = word.AddRusHomonym(res); } return homId; }