diff options
author | Kenneth Heafield <github@kheafield.com> | 2012-10-22 14:04:27 +0100 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2012-10-22 14:04:27 +0100 |
commit | 0ff82d648446645df245decc1e9eafad304eb327 (patch) | |
tree | 0806d429e4f12b672fd6d0461ba8165679bf424d /klm/alone/vocab.cc | |
parent | 5f98fe5c4f2a2090eeb9d30c030305a70a8347d1 (diff) |
Update search, make it compile
Diffstat (limited to 'klm/alone/vocab.cc')
-rw-r--r-- | klm/alone/vocab.cc | 19 |
1 files changed, 0 insertions, 19 deletions
diff --git a/klm/alone/vocab.cc b/klm/alone/vocab.cc deleted file mode 100644 index ffe55301..00000000 --- a/klm/alone/vocab.cc +++ /dev/null @@ -1,19 +0,0 @@ -#include "alone/vocab.hh" - -#include "lm/virtual_interface.hh" -#include "util/string_piece.hh" - -namespace alone { - -Vocab::Vocab(const lm::base::Vocabulary &backing) : backing_(backing), end_sentence_(FindOrAdd("</s>")) {} - -const std::pair<const std::string, lm::WordIndex> &Vocab::FindOrAdd(const StringPiece &str) { - Map::const_iterator i(FindStringPiece(map_, str)); - if (i != map_.end()) return *i; - std::pair<std::string, lm::WordIndex> to_ins; - to_ins.first.assign(str.data(), str.size()); - to_ins.second = backing_.Index(str); - return *map_.insert(to_ins).first; -} - -} // namespace alone |