diff options
author | Kenneth Heafield <github@kheafield.com> | 2012-09-12 12:01:26 +0100 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2012-09-12 12:01:26 +0100 |
commit | c26c35a9bcbb4d42ae50ad0a75c1b5fb59702bd1 (patch) | |
tree | eced40cfee4bff7c4cd3fc644016e45f7903a55a /klm/search/word.hh | |
parent | 2ca3db90bd0a2e9a8619d2ebec7c6ac723838aca (diff) |
Refactor search so that it knows even less, but keeps track of edge pointers
Diffstat (limited to 'klm/search/word.hh')
-rw-r--r-- | klm/search/word.hh | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/klm/search/word.hh b/klm/search/word.hh deleted file mode 100644 index e7a15be9..00000000 --- a/klm/search/word.hh +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef SEARCH_WORD__ -#define SEARCH_WORD__ - -#include "lm/word_index.hh" - -#include <boost/functional/hash.hpp> - -#include <string> -#include <utility> - -namespace search { - -class Word { - public: - // Construct a non-terminal. - Word() : entry_(NULL) {} - - explicit Word(const std::pair<const std::string, lm::WordIndex> &entry) { - entry_ = &entry; - } - - // Returns true for two non-terminals even if their labels are different (since we don't care about labels). - bool operator==(const Word &other) const { - return entry_ == other.entry_; - } - - bool Terminal() const { return entry_ != NULL; } - - const std::string &String() const { return entry_->first; } - - lm::WordIndex Index() const { return entry_->second; } - - protected: - friend size_t hash_value(const Word &word); - - const std::pair<const std::string, lm::WordIndex> *Entry() const { return entry_; } - - private: - const std::pair<const std::string, lm::WordIndex> *entry_; -}; - -inline size_t hash_value(const Word &word) { - return boost::hash_value(word.Entry()); -} - -} // namespace search -#endif // SEARCH_WORD__ |