summaryrefslogtreecommitdiff
path: root/decoder/lextrans.cc
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-11-15 20:22:22 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-11-15 20:22:22 +0000
commitc8c315a4f78c464636ea5e3fd9a11416b2f966b9 (patch)
tree763f25d7db1c5b9add1c33d20f8d290c046ff406 /decoder/lextrans.cc
parentc0afd1924cf0c228a85352b3584c64a5e00b88c7 (diff)
rescoring working
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@726 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/lextrans.cc')
-rw-r--r--decoder/lextrans.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/decoder/lextrans.cc b/decoder/lextrans.cc
index 551e77e3..c3bd775f 100644
--- a/decoder/lextrans.cc
+++ b/decoder/lextrans.cc
@@ -60,7 +60,7 @@ struct LexicalTransImpl {
}
}
- void BuildTrellis(const Lattice& lattice, const SentenceMetadata& smeta, Hypergraph* forest) {
+ bool BuildTrellis(const Lattice& lattice, const SentenceMetadata& smeta, Hypergraph* forest) {
if (psg_file_) {
const string offset = smeta.GetSGMLValue("psg");
if (offset.size() < 2 || offset[0] != '@') {
@@ -86,7 +86,7 @@ struct LexicalTransImpl {
gi = sup_grammar->GetRoot()->Extend(src_sym);
if (!gi) {
cerr << "No translations found for: " << TD::Convert(src_sym) << "\n";
- abort();
+ return false;
}
}
const RuleBin* rb = gi->GetRules();
@@ -117,6 +117,7 @@ struct LexicalTransImpl {
Hypergraph::Node* goal = forest->AddNode(TD::Convert("Goal")*-1);
Hypergraph::Edge* hg_edge = forest->AddEdge(kGOAL_RULE, tail);
forest->ConnectEdgeToHeadNode(hg_edge, goal);
+ return true;
}
private:
@@ -146,7 +147,7 @@ bool LexicalTrans::TranslateImpl(const string& input,
abort();
}
smeta->SetSourceLength(lattice.size());
- pimpl_->BuildTrellis(lattice, *smeta, forest);
+ if (!pimpl_->BuildTrellis(lattice, *smeta, forest)) return false;
forest->is_linear_chain_ = true;
forest->Reweight(weights);
return true;