Exemplo n.º 1
0
std::string FindWord(const trie_type& trie, const std::string& keys, size_t alternative)
{
    typedef std::vector<Word>   Words;

    trie_type::result_type candidates = trie.find(keys);
    
    Words::const_iterator match;
    Words words(candidates.first, candidates.second);
    std::sort(words.begin(), words.end(), boost::mem_fn(&Word::MoreFrequent));

    for (Words::const_iterator word = words.begin(); word != words.end(); ++word)
    {
        match = word;

        if (alternative == 0)
        {
            break;
        }
        else
        {
            --alternative;
        }
    }

    if (match == words.end())
    {
        return "No alternative";
    }
    else
    {
        return match->str();
    }
}
Exemplo n.º 2
0
	iterator find(const Container& container)
	{
		return t.find(container);
	}
Exemplo n.º 3
0
	iterator find(Iter first, Iter last)
	{
		return t.find(first, last);
	}