summaryrefslogtreecommitdiff
path: root/training/ttables.h
diff options
context:
space:
mode:
Diffstat (limited to 'training/ttables.h')
-rw-r--r--training/ttables.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/training/ttables.h b/training/ttables.h
index bf3351d2..9baa13ca 100644
--- a/training/ttables.h
+++ b/training/ttables.h
@@ -4,6 +4,7 @@
#include <iostream>
#include <tr1/unordered_map>
+#include "sparse_vector.h"
#include "m.h"
#include "wordid.h"
#include "tdict.h"
@@ -68,18 +69,18 @@ class TTable {
}
return *this;
}
- void ShowTTable() {
- for (Word2Word2Double::iterator it = ttable.begin(); it != ttable.end(); ++it) {
- Word2Double& cpd = it->second;
- for (Word2Double::iterator j = cpd.begin(); j != cpd.end(); ++j) {
+ void ShowTTable() const {
+ for (Word2Word2Double::const_iterator it = ttable.begin(); it != ttable.end(); ++it) {
+ const Word2Double& cpd = it->second;
+ for (Word2Double::const_iterator j = cpd.begin(); j != cpd.end(); ++j) {
std::cerr << "P(" << TD::Convert(j->first) << '|' << TD::Convert(it->first) << ") = " << j->second << std::endl;
}
}
}
- void ShowCounts() {
- for (Word2Word2Double::iterator it = counts.begin(); it != counts.end(); ++it) {
- Word2Double& cpd = it->second;
- for (Word2Double::iterator j = cpd.begin(); j != cpd.end(); ++j) {
+ void ShowCounts() const {
+ for (Word2Word2Double::const_iterator it = counts.begin(); it != counts.end(); ++it) {
+ const Word2Double& cpd = it->second;
+ for (Word2Double::const_iterator j = cpd.begin(); j != cpd.end(); ++j) {
std::cerr << "c(" << TD::Convert(j->first) << '|' << TD::Convert(it->first) << ") = " << j->second << std::endl;
}
}