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


C++ TermList::begin方法代码示例

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


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

示例1: analyze_search

    int StemAnalyzer::analyze_search( const TermList & input, TermList & output, unsigned char retFlag )
    {
        string inputstr, stem;
        TermList::const_iterator it;

        //unsigned char       level = 0;
        Term                newTerm;
        TermList::iterator  term_it;

        for( it = input.begin(); it != input.end(); it++ )
        {
//            if( retFlag_sch_ & ANALYZE_PRIME_ )
//            {
//                term_it = output.insert( output.end(), *it );
//                term_it->stats_ = makeStatBit( Term::OR_BIT, level++ );
//            }
//            if( (retFlag_sch_ & ANALYZE_SECOND_) == 0 )
//                continue;
//
//
//            it->text_.convertString( inputstr, UString::CP949 );
//            stemmer_.stem( inputstr, stem );
//
//            if( !(retFlag_sch_ & ANALYZE_PRIME_) || inputstr != stem )
//            {
//                term_it = output.insert( output.end(), newTerm );
//
//                term_it->text_.assign( stem, UString::CP949 );
//                term_it->stats_ = makeStatBit( Term::AND_BIT, level );
//            }
        }
        return 0;
    }
开发者ID:izenecloud,项目名称:ilplib,代码行数:33,代码来源:StemAnalyzer.cpp

示例2: analyze_index

    int StemAnalyzer::analyze_index( const TermList & input, TermList & output, unsigned char retFlag )
    {
        string inputstr, stem;
        TermList::const_iterator it;

        Term newTerm;
        TermList::iterator term_it;

        for( it = input.begin(); it != input.end(); it++ )
        {
//            if( retFlag_idx_ & ANALYZE_PRIME_ )
//            {
//                term_it = output.insert( output.end(), *it );
//            }
//            if( (retFlag_idx_ & ANALYZE_SECOND_) == 0 )
//                continue;
//
//
//            it->text_.convertString( inputstr, UString::CP949 );
//            stemmer_.stem( inputstr, stem );
//
//            if( !(retFlag_idx_ & ANALYZE_PRIME_) || inputstr != stem )
//            {
//                term_it = output.insert( output.end(), *it );
//                term_it->text_.assign( stem, UString::CP949 );
//            }
        }
        return 0;
    }
开发者ID:izenecloud,项目名称:ilplib,代码行数:29,代码来源:StemAnalyzer.cpp

示例3: tag

    void POSTaggerEnglish::tag(const TermList & input, TermList & output )
    {
        std::vector<Token> vt;

        TermList::const_iterator it = input.begin();
        for(; it != input.end() ; it++)
            vt.push_back(Token(it->textString(), "?"));

        const multimap<std::string, std::string> dummy;

        bidir_decode_beam(vt, dummy, vme_);

        output = input;
        TermList::iterator it2 = output.begin();

        for (size_t i = 0; i < vt.size(); i++,it2++) 
        {
            it2->pos_ = vt[i].prd;
        }
    }
开发者ID:izenecloud,项目名称:ilplib,代码行数:20,代码来源:POSTaggerEnglish.cpp

示例4: getAdmissibleSolution

// TODO there's a seriouxx need for refactoring here !
Solution LpsolveAdaptator::getAdmissibleSolution(LinearProblem * lp) {
	lprec *lprec;
	int nbCol = lp->getVariables().size();
	lprec = make_lp(0, nbCol);

	if (lprec == NULL) {
		// TODO raise an exception
	}

	/* set variables name to ease debugging */
	for (int i = 0; i < (int)lp->getVariables().size(); ++i) {
		Variable * var = (lp->getVariables())[i];
		set_col_name(lprec, i+1, var->getNameToChar());
		if (var->isBinary()) {
			set_binary(lprec, i+1, TRUE);
		}
	}

	/* to build the model faster when adding constraints one at a time */
	set_add_rowmode(lprec, TRUE);

	for (int i = 0; i < (int)(lp->getConstraints().size()); ++i) {
		// FIXME there's a bug here but I can't find it
		Constraint c = (Constraint)(lp->getConstraints()[i]);
		TermList terms = c.getTerms();
		int col[terms.size()];
		REAL row[terms.size()];
		int j = 0;
		for (TermList::const_iterator it = terms.begin(); it != terms.end();
				++it, ++j) {
			// TODO check if this is fixed
			col[j] = ((Term)*it).getVariable().getPosition();
			row[j] = ((Term)*it).getCoeff();
		}
		// WARNING the Consraint uses the same operator values than in lp_lib.h
		if (!add_constraintex(lprec, j, row, col, c.getOperator(), c.getBound())) {
			// TODO raise an exception
		}
	}

	/* the objective function requires rowmode to be off */
	set_add_rowmode(lprec, FALSE);

	return getSolution(lprec);
}
开发者ID:falcong,项目名称:portfolio-opti,代码行数:46,代码来源:LpsolveAdaptator.cpp

示例5: getSynonym

bool CommonLanguageAnalyzer::getSynonym(
        const UString& combine,
        int offset,
        const unsigned char andOrBit,
        const unsigned int level,
        TermList& syOutList,
        unsigned int& subLevel)
{
    bool ret = false;
    //cout << "combined: "; combine.displayStringValue(izenelib::util::UString::UTF_8); cout << endl;

    char* combineStr = lowercase_string_buffer_;
    UString::convertString(UString::UTF_8, combine.c_str(), combine.length(), lowercase_string_buffer_, term_string_buffer_limit_);

    //cout << "combined string: " << string(combineStr) << endl;

    UString::CharT * synonymResultUstr = NULL;
    size_t synonymResultUstrLen = 0;

    pSynonymContainer_ = uscSPtr_->getSynonymContainer();
    pSynonymContainer_->searchNgetSynonym(combineStr, pSynonymResult_);

    for (int i =0; i<pSynonymResult_->getSynonymCount(0); i++)
    {
        char * synonymResult = pSynonymResult_->getWord(0, i);
        if (synonymResult)
        {
            if (strcmp(combineStr, synonymResult) == 0)
            {
                //cout << "synonym self: "<<string(synonymResult) <<endl;
                continue;
            }
            cout << "synonym : "<<string(synonymResult) <<endl;
            ret = true;

            size_t synonymResultLen = strlen(synonymResult);
            if (synonymResultLen <= term_ustring_buffer_limit_)
            {
                synonymResultUstr = synonym_ustring_buffer_;
                synonymResultUstrLen = UString::toUcs2(synonymEncode_,
                        synonymResult, synonymResultLen, synonym_ustring_buffer_, term_ustring_buffer_limit_);
            }

            // word segmentment
            UString term(synonymResultUstr, synonymResultUstrLen);
            TermList termList;
            if (innerAnalyzer_.get())
            {
                innerAnalyzer_->analyze(term, termList);
                if (termList.size() <= 1)
                {
                    syOutList.add(synonymResultUstr, synonymResultUstrLen, offset, NULL, andOrBit, level+subLevel);
                    subLevel++;
                }
                else
                {
                    for (TermList::iterator iter = termList.begin(); iter != termList.end(); ++iter)
                    {
                        syOutList.add(iter->text_.c_str(), iter->text_.length(), offset, NULL, Term::AND, level+subLevel);
                    }
                    subLevel++;
                }
            }
            else
            {
                syOutList.add(synonymResultUstr, synonymResultUstrLen, offset, NULL, andOrBit, level+subLevel);
                subLevel++;
            }
        }
    }

    return ret;
}
开发者ID:izenecloud,项目名称:ilplib,代码行数:73,代码来源:CommonLanguageAnalyzer.cpp


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