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


C++ yvector::end方法代码示例

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


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

示例1: ArchiveAutomatSymbolInterpetationUnions

void CWord::ArchiveAutomatSymbolInterpetationUnions(yvector<TerminalSymbolType>& vecUnionsArchive)
{
    if (m_AutomatSymbolInterpetationUnion.size() == 0)
        return;
    vecUnionsArchive.push_back(m_AutomatSymbolInterpetationUnion.size());
    vecUnionsArchive.insert(vecUnionsArchive.end(), m_AutomatSymbolInterpetationUnion.begin(), m_AutomatSymbolInterpetationUnion.end());

    for (SHomIt it = IterHomonyms(); it.Ok(); ++it) {
        vecUnionsArchive.push_back(it->m_AutomatSymbolInterpetationUnion.size());
        vecUnionsArchive.insert(vecUnionsArchive.end(), it->m_AutomatSymbolInterpetationUnion.begin(), it->m_AutomatSymbolInterpetationUnion.end());
    }
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:12,代码来源:word.cpp

示例2: BuildRuleInfo

static void BuildRuleInfo(const yset<CWorkRule>& rules, yvector<CGLRRuleInfo>& res)
{
    res.clear();
    for (yset<CWorkRule>::const_iterator it = rules.begin(); it != rules.end(); ++it) {
        res.push_back();
        res.back().Init(&*it);
    }
    std::sort(res.begin(), res.end());
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:9,代码来源:glrtable.cpp

示例3: SolveAmbiguity

void SolveAmbiguity(yvector<COccurrence>& Occurrences, yvector<size_t>& res)
{
    if (Occurrences.size() == 0)
        return;

    if (Occurrences.size() == 1) {
        res.push_back(0);
        return;
    }

    std::sort(Occurrences.begin(), Occurrences.end(), SortByRightBorderPredicate);

    yvector<CPeriodSolutionWeight> solutions(Occurrences.size());
    for (size_t i = 0; i < Occurrences.size(); ++i) {
        const COccurrence& cur_occurrence = Occurrences[i];
        const CPeriodSolutionWeight* best_overlapping_solution = NULL;
        const CPeriodSolutionWeight* best_non_overlapping_solution = NULL;
        for (int j = i - 1; j >= 0; --j)
            if (Occurrences[j].second <= cur_occurrence.first)       //does not intersect
            {
                best_non_overlapping_solution = &(solutions[j]);
                break;
            } else if (best_overlapping_solution == NULL || *best_overlapping_solution < solutions[j])
                best_overlapping_solution = &(solutions[j]);

        CPeriodSolutionWeight& cur_solution = solutions[i];
        if (best_non_overlapping_solution == NULL)
            cur_solution.m_VirtualGroup.SetPair(cur_occurrence.first, cur_occurrence.first);
        else
            cur_solution = *best_non_overlapping_solution;     // nasty copying!
        cur_solution.AddOccurrence(cur_occurrence, i);

        //if overlapped solution is still better
        if (best_overlapping_solution != NULL && cur_solution < *best_overlapping_solution)
            cur_solution = *best_overlapping_solution;           // nasty copying again!
    }
    CPeriodSolutionWeight& best_solution = solutions.back();
    res.swap(best_solution.m_Solution);
}
开发者ID:johny-nsk,项目名称:tomita-parser,代码行数:39,代码来源:solveperiodambiguity.cpp

示例4: SolveAmbiguity_Old

void SolveAmbiguity_Old(yvector< COccurrence >& Occurrences)
{
    //previous version of disambiguation - it is quite slower in worst cases

    sort (Occurrences.begin(), Occurrences.end());
    InitAmbiguousSlot(Occurrences);
    //int CountOfAmbigousPlaces = 0;
    for (size_t i = 0; i + 1 < Occurrences.size(); ++i)
        if    (Occurrences[i + 1].first < Occurrences[i].second) {
            CPeriodSolutionWeight Solution;
            Solution.m_VirtualGroup.SetPair(Occurrences[i].first,Occurrences[i].first);

            size_t MaxRightBorder = Occurrences[i].second;
            SolveAmbiguityRecursive(Occurrences,i, Solution, MaxRightBorder);

            assert (!Solution.m_Solution.empty());

            int j=Solution.m_Solution.back() + 1;

            for (; j < (int)Occurrences.size(); ++j)
                if (Occurrences[j].first >= Occurrences[Solution.m_Solution.back()].second)
                    break;

            Occurrences.erase(Occurrences.begin() + Solution.m_Solution.back() + 1, Occurrences.begin() + j);

            for (size_t k=Solution.m_Solution.size() - 1; k > 0; --k) {
                size_t start = Solution.m_Solution[k - 1] + 1;
                size_t end = Solution.m_Solution[k];
                Occurrences.erase(Occurrences.begin() + start, Occurrences.begin() + end);
            };
            Occurrences.erase(Occurrences.begin() + i, Occurrences.begin() + Solution.m_Solution[0]);
            //CountOfAmbigousPlaces++;
        };
    //printf ("Count Of Ambiguous Places is %i\n",CountOfAmbigousPlaces);;

};
开发者ID:johny-nsk,项目名称:tomita-parser,代码行数:36,代码来源:solveperiodambiguity.cpp

示例5: BuildClauseVariantsRec

void CTopClauses::BuildClauseVariantsRec(yvector<CClauseVariant>& ClauseVars, CClauseNode* node)
{
    yvector<CClauseVariant> saveVars;
    if (node->m_outNodes.size() > 1)
        saveVars = ClauseVars;
    for (size_t i = 0; i < node->m_outNodes.size(); i++) {
        CClauseNode* node1 = node->m_outNodes[i].m_pNode;
        if (node1->IsEndNode())
            return;
        if (i == 0) {
            for (size_t j = 0; j < ClauseVars.size(); j++)
                AddClausesToClauseVar(ClauseVars[j], node1->m_pClauseTree);
                //ClauseVars[j].AddClauses(node1->m_pClauseTree->m_Clauses);
            BuildClauseVariantsRec(ClauseVars, node1);
        } else {
            yvector<CClauseVariant> saveVarsCopy = saveVars;
            for (size_t j = 0; j < saveVarsCopy.size(); j++)
                AddClausesToClauseVar(saveVarsCopy[j], node1->m_pClauseTree);
                //saveVarsCopy[j].AddClauses(node1->m_pClauseTree->m_Clauses);
            BuildClauseVariantsRec(saveVarsCopy, node1);
            ClauseVars.insert(ClauseVars.end(), saveVarsCopy.begin(), saveVarsCopy.end());
        }
    }
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:24,代码来源:topclauses.cpp

示例6: FindCloseQuoteInNextSentences

// ищет закрывающую кавычку в текущем или последующем предложениях,
// добавляет все слова до закрывающей кавычки к ResultToAdd
// игнорируем внутренние кавычки
bool CQuotesFinder::FindCloseQuoteInNextSentences(int StartSentNo, int StartWordForFirstSentence, Wtroka& ResultToAdd,
                                                  yvector<SFactAddress>& FioInQuotes, SLeadInfo& LeadInfo)
{
    Wtroka Add;
    yvector<SFactAddress> AddFioInQuotes;
    int Depth = 1;
    for (int SentNo=StartSentNo; (SentNo-StartSentNo<=2)&& (SentNo< (int)m_vecSentence.size()); SentNo++) {
        CSentenceRusProcessor* pSent = GetSentPrc(SentNo);
        yset<int> QuoteWords;
        int k=0;
        if (SentNo == StartSentNo)
            k = StartWordForFirstSentence;
        for (; k < (int)pSent->getWordsCount(); k++) {
            const CWord& w = *pSent->getWordRus(k);
            Add += w.GetOriginalText() + ' ';
            QuoteWords.insert(k);
            bool bHasCloseQuote = false;
            if (w.HasOpenQuote()) {
                if (ispunct(w.GetText()[0])) {
                    Depth--;                    // одиночную кавычку  знака препинания считаем закр. кавычкой  (кто-то по ошибке поставил пробел)
                    bHasCloseQuote = true;;
                } else
                    Depth++;
            }
            if (w.HasCloseQuote()) {
                Depth--;
                if ((Depth == 1) // Закрывающая кавычка в конце предложения закрывает все открытые кавычки.
                        &&  ((k+1 == (int)pSent->getWordsCount())
                                ||      ((k+2 == (int)pSent->getWordsCount())
                                            &&  pSent->getWordRus(k+1)->IsPunct()
                                        )
                            )
                    ) {
                    Depth  = 0;
                }
                bHasCloseQuote = true;
            }
            if (w.GetText() == Wtroka::FromAscii("\"")) {
                if (k+1 == (int)pSent->getWordsCount() || pSent->getWordRus(k+1)->IsPunct()) {
                    bHasCloseQuote = true;
                    Depth--;
                }
            }
            if (bHasCloseQuote && Depth == 0) {
                if (!Add.empty() && Add[0] == '-') {
                    const wchar16* beg = Add.begin() + 1;
                    StripRangeBegin(beg, Add.end());
                    Add.assign(beg, Add.end() - beg);
                }
                if (ResultToAdd.back() == ',' && Add.size() > 0 && NStr::IsLangAlpha(Add[0], TMorph::GetMainLanguage()) && ::IsUpper(Add[0])) {
                    ResultToAdd.erase(ResultToAdd.size() - 1);
                    ResultToAdd += CharToWide(". ");
                }

                ResultToAdd += Add;
                AddFios(SentNo, QuoteWords, AddFioInQuotes);
                FioInQuotes.insert(FioInQuotes.end(), AddFioInQuotes.begin(), AddFioInQuotes.end());
                LeadInfo.m_iLastSent = SentNo;
                return true;
            }
        }
        AddFios(SentNo, QuoteWords, AddFioInQuotes);
    }
    return false;
}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:68,代码来源:quotesfinder.cpp


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