summaryrefslogtreecommitdiff
path: root/decoder/sparse_vector.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-19 22:51:33 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-19 22:51:33 +0000
commita2e4142d6a737bff040c3f2a583da6e8244db01a (patch)
treedce70b212c143f3149c8280698ee5abce7fd6cda /decoder/sparse_vector.h
parent1b606343b7368aa4c61d5088b22b8916486f0073 (diff)
shared_ptr for scores. todo: intrusive.
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@327 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/sparse_vector.h')
-rw-r--r--decoder/sparse_vector.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/decoder/sparse_vector.h b/decoder/sparse_vector.h
index f41bedf5..5e785210 100644
--- a/decoder/sparse_vector.h
+++ b/decoder/sparse_vector.h
@@ -1,5 +1,7 @@
#ifndef _SPARSE_VECTOR_H_
#define _SPARSE_VECTOR_H_
+/* hack: index 0 never gets printed because cdyer is creative and efficient. features which have no weight got feature dict id 0, see, and the models all clobered that value. nobody wants to see it. except that vlad is also creative and efficient and stored the oracle bleu there. */
+
// this is a modified version of code originally written
// by Phil Blunsom
@@ -54,6 +56,12 @@ public:
}
+ // warning: exploits the fact that 0 values are always removed from map. change this if you change that.
+ bool nonzero(int index) const {
+ return values_.find(index) != values_.end();
+ }
+
+
const T operator[](int index) const {
typename MapType::const_iterator found = values_.find(index);
if (found == values_.end())