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(); } }
iterator_range find_prefix(Iter first, Iter last) { return t.find_prefix(first, last); }
reverse_iterator rend() { return t.rend(); }
reverse_iterator rbegin() { return t.rbegin(); }
const_iterator end() const { return t.end(); }
const_iterator cbegin() const { return t.cbegin(); }
iterator begin() { return t.begin(); }
void swap(const trie_map_type& other) { t.swap(other.t); }
iterator erase(const_iterator it) { return t.erase(it); }
// erasions iterator erase(iterator it) { return t.erase(it); }
iterator lower_bound(const Container& container) { return (iterator)t.lower_bound(container); }
iterator lower_bound(Iter first, Iter last) { return (iterator)t.lower_bound(first, last); }
iterator upper_bound(const Container& container) { return (iterator)t.upper_bound(container); }
iterator upper_bound(Iter first, Iter last) { return (iterator)t.upper_bound(first, last); }
iterator_range find_prefix(const Container& container) { return t.find_prefix(container); }
size_type size() const { return t.size(); }
bool empty() { return t.empty(); }
reverse_iterator erase(reverse_iterator it) { return t.erase(it); }
void clear() { t.clear(); }
reverse_iterator erase(const_reverse_iterator it) { return t.erase(it); }
const_iterator begin() const { return t.begin(); }
iterator erase(const Container &container) { return t.erase(container); }
iterator end() { return t.end(); }
iterator erase(Iter first, Iter last) { return t.erase(first, last); }
const_iterator cend() const { return t.cend(); }
size_type erase_prefix(const Container &container) { return t.erase_prefix(container); }
const_reverse_iterator crbegin() const { return t.crbegin(); }
size_type erase_prefix(Iter first, Iter last) { return t.erase_prefix(first, last); }
const_reverse_iterator rend() const { return t.rend(); }
size_type count_node() const { return t.count_node(); }