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


C++ CWord::AddRusHomonym方法代码示例

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


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

示例1: AddQuoteMultiWord

void CMultiWordCreator::AddQuoteMultiWord(CWordSequence& ws, const TArticleRef& article)
{
    SWordHomonymNum wh;
    Wtroka str;
    CWord* pNewWord = GetWordForMultiWord(ws, str, wh);
    if (pNewWord->m_SourceWords.Size() == 1 && pNewWord->HasOnlyUnknownPOS()) {
        size_t firstId = pNewWord->IterHomonyms().GetID();
        CHomonym& h = pNewWord->GetRusHomonym(firstId);
        h.SetSourceWordSequence(&ws);
        h.PutArticle(article);
        wh.m_HomNum = firstId;
    } else {
        pNewWord->m_SourceWords.SetPair(ws.FirstWord(), ws.LastWord());
        if (str.size() == 0)
            str = pNewWord->m_txt;
        TMorph::ToLower(str);
        CHomonym* pNewHom = new CHomonym(TMorph::GetMainLanguage(), str);
        pNewHom->SetSourceWordSequence(&ws);
        pNewHom->PutArticle(article);
        wh.m_HomNum = pNewWord->AddRusHomonym(pNewHom);
    }

    if (article.AuxDic().IsValid()) {
        const article_t* pArt =  GlobalDictsHolder->GetAuxArticle(article.AuxDic());
        YASSERT(pArt != NULL);
        AddFoundArticle(pArt->get_kw_type(), pArt->get_title(), wh);
    } else {
        YASSERT(!article.Gzt().Empty());
        AddFoundArticle(article.Gzt().GetType(), article.Gzt().GetTitle(), wh);
    }

    m_wordSequences.push_back(&ws);
}
开发者ID:dubrousky,项目名称:tomita-parser,代码行数:33,代码来源:multiwordcreator.cpp

示例2: FindOrMakeMultiwordHomonym

// 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;
}
开发者ID:dubrousky,项目名称:tomita-parser,代码行数:21,代码来源:multiwordcreator.cpp


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