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


C++ CWord类代码示例

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


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

示例1: LongestPieceFixedStart

CWord::size_type LongestPieceFixedStart(const CWord& w) {
  CWord::size_type result = 1;
  auto shifted = w;
  shifted.CyclicLeftShift();
  while (shifted != w) {
    result = std::max(result, CommonPrefixLength(w, shifted));
    if (result * 6 >= w.size()) {
      return result;
    }
    shifted.CyclicLeftShift();
  }

  auto inverse = w.Inverse();
  if (LeastCyclicShift(inverse) == LeastCyclicShift(w)) {
    return result;
  }
  result = std::max(result, CommonPrefixLength(w, inverse));
  inverse.CyclicLeftShift();

  while (inverse != w.Inverse()) {
    result = std::max(result, CommonPrefixLength(w, inverse));
    if (result * 6 >= w.size()) {
      return result;
    }
    inverse.CyclicLeftShift();
  }

  return result;
}
开发者ID:dpantele,项目名称:acc,代码行数:29,代码来源:analyze.cpp

示例2: GetWordForMultiWord

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

示例3: SetCurLine

bool CAsmFile::ParseBlockCMT()
{
		// 扫描注释.
	SetCurLine(0);
	CWord* pWord = NULL;
	bool bCmt = false;
	do 
	{
		// 寻找 / *
		while ((pWord = GetAllNextWord()) != NULL)
		{
			string& str = pWord->GetWord();
			if (str == "/*")
			{
				bCmt = true;
				pWord->SetAttrib(EWORD_COMMENT);
				break;
			}
		}
		// 标记注释和结束符
		while ((pWord = GetAllNextWord()) != NULL)
		{
			string& str = pWord->GetWord();
			pWord->SetAttrib(EWORD_COMMENT);
			if (str == "*/")
			{
				bCmt = false;
				break;
			}
		}
	} while (pWord != NULL);
	return (bCmt == false);
}
开发者ID:antboard,项目名称:c2html_mac,代码行数:33,代码来源:asmFile.cpp

示例4: ExtractText

inline Wtroka ExtractText(const CWord& word, const CWordVector& allWords) {
    Wtroka res = word.IsMultiWord() ? allWords.ToString(word) : word.GetText();
    if (word.IsFirstInSentence() && !word.HasAtLeastTwoUpper()) {
        // Remove title-case for the first word of a sentence (not having other upper-cased letters)
        TMorph::ToLower(res);
    }
    return res;
}
开发者ID:dubrousky,项目名称:tomita-parser,代码行数:8,代码来源:homonym.cpp

示例5: CommonPrefixLength

CWord::size_type CommonPrefixLength(CWord u, CWord v) {
  CWord::size_type result = 0;
  while (u.GetFront() == v.GetFront()) {
    ++result;
    u.PopFront();
    v.PopFront();
  }
  return result;
}
开发者ID:dpantele,项目名称:acc,代码行数:9,代码来源:analyze.cpp

示例6: ConjugationInverseNormalForm

CWord ConjugationInverseNormalForm(const CWord& w) {
  assert(w.Empty() || w.GetBack().Inverse() != w.GetFront());
  auto min_w = LeastCyclicPermutation(w);
  auto min_i = LeastCyclicPermutation(w.Inverse());
  if (min_w < min_i) {
    return min_w;
  } else {
    return min_i;
  }
}
开发者ID:dpantele,项目名称:acc,代码行数:10,代码来源:tuple_normal_form.cpp

示例7: HasDeclinableSynNounInInstrumentalis

bool CAnalyticFormBuilder::HasDeclinableSynNounInInstrumentalis(const CWord& _W) const
{
    for (CWord::SHomIt it = _W.IterHomonyms(); it.Ok(); ++it)
        if (IsSynNoun(*it) && it->HasGrammem(gInstrumental) && !it->HasGrammem(gNominative))
            return true;
    return false;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,代码来源:analyticformbuilder.cpp

示例8: HasShortParticipleOrAdj

bool CAnalyticFormBuilder::HasShortParticipleOrAdj(const CWord& _W) const
{
    for (CWord::SHomIt it = _W.IterHomonyms(); it.Ok(); ++it)
        if (it->IsShortAdjectiveOrParticiple())
            return true;
    return false;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:7,代码来源:analyticformbuilder.cpp

示例9: HasCommonHomonyms

bool CWord::HasCommonHomonyms(const CWord& w) const
{
    if (!IsDictionary() || !w.IsDictionary()) {
        SHomIt it1 = IterHomonyms();
        SHomIt it2 = w.IterHomonyms();
        if (it1.Ok() && it2.Ok() && TMorph::IdentifSimilar(it1->Lemma, it2->Lemma))
            return true;
    }

    for (SHomIt it1 = IterHomonyms(); it1.Ok(); ++it1)
        for (SHomIt it2 = w.IterHomonyms(); it2.Ok(); ++it2)
            if (it1->Lemma == it2->Lemma)
                return true;

    return false;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:16,代码来源:word.cpp

示例10: HasCompar

bool CAnalyticFormBuilder::HasCompar(const CWord& W)
{
    for (CWord::SHomIt it = W.IterHomonyms(); it.Ok(); ++it)
        if (it->IsFullAdjective() && it->HasGrammem(gComparative))
            return true;

    return false;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:8,代码来源:analyticformbuilder.cpp

示例11: HasInfinitive

bool CAnalyticFormBuilder::HasInfinitive(const CWord& W)
{
    for (CWord::SHomIt it = W.IterHomonyms(); it.Ok(); ++it)
        if (it->HasGrammem(gInfinitive))
            return true;

    return false;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:8,代码来源:analyticformbuilder.cpp

示例12: ToHTMLColorString

Stroka CSentence::ToHTMLColorString(const yvector<CWordsPair>& wp, const Stroka& sColor, ECharset encoding) const
{
    Stroka str;
    for (size_t i = 0; i + 1 <= m_words.size(); ++i) {
        CWord* pW = m_words[i].Get();
        for (size_t j = 0; j < wp.size(); ++j)
            if (wp[j].FirstWord() == (int)i)
                str += Substitute("<font color=\"$0\">", sColor);
        if (i > 0 && (!pW->IsPunct() || pW->IsOpenBracket() || pW->IsCloseBracket()))
            str += " ";
        str += NStr::Encode(pW->GetOriginalText(), encoding);
        for (size_t j = 0; j < wp.size(); ++j)
            if (wp[j].LastWord() == (int)i)
                str += "</font>";
    }
    return StripString(str);
}
开发者ID:dubrousky,项目名称:tomita-parser,代码行数:17,代码来源:sentence.cpp

示例13: HasPredik

bool CAnalyticFormBuilder::HasPredik(const CWord& W)
{
    for (CWord::SHomIt it = W.IterHomonyms(); it.Ok(); ++it)
        if (!it->Grammems.IsIndeclinable()) //  "бух","спасибо" не строятся с анал. формами
            if (it->HasGrammem(gPraedic))
                return true;

    return false;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:9,代码来源:analyticformbuilder.cpp

示例14: getPossibleTagsBySuffix

unsigned long long TARGET_LANGUAGE::CTagger::getPossibleTagsForWord( const CWord &word ) {
   static unsigned long long possible_tags;
   possible_tags = m_TagDict.lookup(word);
   if (possible_tags==0) possible_tags = ~0L;
#ifdef _ENGLISH_TAGS_H
   possible_tags |= getPossibleTagsBySuffix( word.str() );
   possible_tags |= PENN_TAG_MUST_SEE ;
#endif
   assert(possible_tags!=0);
   return possible_tags;
}
开发者ID:StevenLOL,项目名称:zpar,代码行数:11,代码来源:tagger.cpp

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