summaryrefslogtreecommitdiff
path: root/klm/lm/enumerate_vocab.hh
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-11-10 22:45:13 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-11-10 22:45:13 +0000
commit3204a77dfd5bff0b5c6d12a272ec939a882c7697 (patch)
tree75e901641477cb65e55fe9ac0a2745802b81ab23 /klm/lm/enumerate_vocab.hh
parentfd02041c3f1bd1157ecf7c0dbd1c444fb02aa313 (diff)
forgotten files
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@710 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'klm/lm/enumerate_vocab.hh')
-rw-r--r--klm/lm/enumerate_vocab.hh29
1 files changed, 29 insertions, 0 deletions
diff --git a/klm/lm/enumerate_vocab.hh b/klm/lm/enumerate_vocab.hh
new file mode 100644
index 00000000..7a2f7d12
--- /dev/null
+++ b/klm/lm/enumerate_vocab.hh
@@ -0,0 +1,29 @@
+#ifndef LM_ENUMERATE_VOCAB__
+#define LM_ENUMERATE_VOCAB__
+
+#include "lm/word_index.hh"
+#include "util/string_piece.hh"
+
+namespace lm {
+namespace ngram {
+
+/* If you need the actual strings in the vocabulary, inherit from this class
+ * and implement Add. Then put a pointer in Config.enumerate_vocab.
+ * Add is called once per n-gram. index starts at 0 and increases by 1 each
+ * time.
+ */
+class EnumerateVocab {
+ public:
+ virtual ~EnumerateVocab() {}
+
+ virtual void Add(WordIndex index, const StringPiece &str) = 0;
+
+ protected:
+ EnumerateVocab() {}
+};
+
+} // namespace ngram
+} // namespace lm
+
+#endif // LM_ENUMERATE_VOCAB__
+