Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/search
diff options
context:
space:
mode:
authorRico Sennrich <rico.sennrich@gmx.ch>2014-04-04 18:54:48 +0400
committerRico Sennrich <rico.sennrich@gmx.ch>2014-04-04 18:54:48 +0400
commit395285d879e63042e29e3ad3a7c71a9bf16aa586 (patch)
tree9d08fc314f0a91fe5e6a9ddaa7d261056f22ed03 /search
parent59098ac66492bd62f40813b72e0aadca3963caf1 (diff)
more logging for incremental chart search
Diffstat (limited to 'search')
-rw-r--r--search/applied.hh3
-rw-r--r--search/edge_generator.cc1
-rw-r--r--search/header.hh12
-rw-r--r--search/nbest.cc2
4 files changed, 14 insertions, 4 deletions
diff --git a/search/applied.hh b/search/applied.hh
index bd659e5c0..8130e243d 100644
--- a/search/applied.hh
+++ b/search/applied.hh
@@ -24,9 +24,10 @@ template <class Below> class GenericApplied : public Header {
*child_out = Below(part->End());
}
- GenericApplied(void *location, Score score, Arity arity, Note note) : Header(location, arity) {
+ GenericApplied(void *location, Score score, Arity arity, Note note, Moses::WordsRange range) : Header(location, arity) {
SetScore(score);
SetNote(note);
+ SetRange(range);
}
explicit GenericApplied(History from) : Header(from) {}
diff --git a/search/edge_generator.cc b/search/edge_generator.cc
index dd9d61e41..1f933453d 100644
--- a/search/edge_generator.cc
+++ b/search/edge_generator.cc
@@ -80,6 +80,7 @@ template <class Model> PartialEdge EdgeGenerator::Pop(Context<Model> &context) {
alternate.SetScore(top.GetScore() + alternate_changed.Bound() - old_value.Bound());
alternate.SetNote(top.GetNote());
+ alternate.SetRange(top.GetRange());
PartialVertex *alternate_nt = alternate.NT();
for (Arity i = 0; i < victim; ++i) alternate_nt[i] = top_nt[i];
diff --git a/search/header.hh b/search/header.hh
index 69f0eed04..d70524097 100644
--- a/search/header.hh
+++ b/search/header.hh
@@ -1,9 +1,10 @@
#ifndef SEARCH_HEADER__
#define SEARCH_HEADER__
-// Header consisting of Score, Arity, and Note
+// Header consisting of Score, Arity, Note and WordsRange
#include "search/types.hh"
+#include "moses/WordsRange.h"
#include <stdint.h>
@@ -38,6 +39,13 @@ class Header {
*reinterpret_cast<Note*>(base_ + sizeof(Score) + sizeof(Arity)) = to;
}
+ Moses::WordsRange GetRange() const {
+ return *reinterpret_cast<const Moses::WordsRange*>(base_ + sizeof(Score) + sizeof(Arity) + sizeof(Note));
+ }
+ void SetRange(Moses::WordsRange to) {
+ *reinterpret_cast<Moses::WordsRange*>(base_ + sizeof(Score) + sizeof(Arity) + sizeof(Note)) = to;
+ }
+
uint8_t *Base() { return base_; }
const uint8_t *Base() const { return base_; }
@@ -50,7 +58,7 @@ class Header {
*reinterpret_cast<Arity*>(base_ + sizeof(Score)) = arity;
}
- static const std::size_t kHeaderSize = sizeof(Score) + sizeof(Arity) + sizeof(Note);
+ static const std::size_t kHeaderSize = sizeof(Score) + sizeof(Arity) + sizeof(Note) + sizeof(Moses::WordsRange);
uint8_t *After() { return base_ + kHeaderSize; }
const uint8_t *After() const { return base_ + kHeaderSize; }
diff --git a/search/nbest.cc b/search/nbest.cc
index acfc08049..8445826f1 100644
--- a/search/nbest.cc
+++ b/search/nbest.cc
@@ -70,7 +70,7 @@ void NBestList::MoveTop(util::Pool &pool) {
Score change = child->in_->Visit(pool, child->index_);
if (change != -INFINITY) {
assert(change < 0.001);
- QueueEntry new_entry(pool.Allocate(QueueEntry::Size(entry.GetArity())), basis + change, entry.GetArity(), entry.GetNote());
+ QueueEntry new_entry(pool.Allocate(QueueEntry::Size(entry.GetArity())), basis + change, entry.GetArity(), entry.GetNote(), entry.GetRange());
std::copy(children_begin, child, new_entry.Children());
RevealedRef *update = new_entry.Children() + (child - children_begin);
update->in_ = child->in_;