From e6f2dd6892e277d0a868c22f726c4a83c86da016 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Sat, 2 Aug 2014 14:34:57 +0200
Subject: finally
---
decoder/decoder.cc | 2 +-
decoder/scfg_translator.cc | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
(limited to 'decoder')
diff --git a/decoder/decoder.cc b/decoder/decoder.cc
index 081da8d6..c384c33f 100644
--- a/decoder/decoder.cc
+++ b/decoder/decoder.cc
@@ -366,7 +366,7 @@ DecoderImpl::DecoderImpl(po::variables_map& conf, int argc, char** argv, istream
("beam_prune3", po::value(), "Optional pass 3")
("add_pass_through_rules,P","Add rules to translate OOV words as themselves")
- ("add_extra_pass_through_features,Q", po::value()->default_value(6), "Add PassThrough{1..N} features, capped at N.")
+ ("add_extra_pass_through_features,Q", po::value()->default_value(0), "Add PassThrough{1..N} features, capped at N.")
("k_best,k",po::value(),"Extract the k best derivations")
("unique_k_best,r", "Unique k-best translation list")
("aligner,a", "Run as a word/phrase aligner (src & ref required)")
diff --git a/decoder/scfg_translator.cc b/decoder/scfg_translator.cc
index 0c3e4cf7..c3cfcaad 100644
--- a/decoder/scfg_translator.cc
+++ b/decoder/scfg_translator.cc
@@ -64,19 +64,21 @@ PassThroughGrammar::PassThroughGrammar(const Lattice& input, const string& cat,
const int j = alts[k].dist2next + i;
const string& src = TD::Convert(alts[k].label);
if (ss.count(alts[k].label) == 0) {
- TRulePtr pt;
if (num_pt_features > 0) {
int length = static_cast(log(UTF8StringLen(src)) / log(1.6)) + 1;
if (length > num_pt_features) length = num_pt_features;
string len_feat = "PassThrough_0=1";
len_feat[12] += length;
TRulePtr pt(new TRule("[" + cat + "] ||| " + src + " ||| " + src + " ||| PassThrough=1 " + len_feat));
+ pt->a_.push_back(AlignmentPoint(0,0));
+ AddRule(pt);
+ RefineRule(pt, ctf_level);
} else {
TRulePtr pt(new TRule("[" + cat + "] ||| " + src + " ||| " + src + " ||| PassThrough=1 "));
pt->a_.push_back(AlignmentPoint(0,0));
+ AddRule(pt);
+ RefineRule(pt, ctf_level);
}
- AddRule(pt);
- RefineRule(pt, ctf_level);
ss.insert(alts[k].label);
}
}
--
cgit v1.2.3