From d6d06b9c2d81adcaededab27c5e022e4718dd4c6 Mon Sep 17 00:00:00 2001 From: redpony Date: Mon, 15 Nov 2010 20:22:22 +0000 Subject: rescoring working git-svn-id: https://ws10smt.googlecode.com/svn/trunk@726 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/lextrans.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'decoder/lextrans.cc') 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; -- cgit v1.2.3