summaryrefslogtreecommitdiff
path: root/decoder
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2013-06-20 01:28:43 +0200
committerPatrick Simianer <p@simianer.de>2013-06-20 01:28:43 +0200
commit64fc39f97b62d9575eeb8da8067b1b09b71c0f84 (patch)
tree7475ae5578f40d3deabeef4532e3a81e2c662ad5 /decoder
parent3b9f1972dd2c0874c5845b68f9bd7f955b6d67eb (diff)
parent0dc7755f7fb1ef15db5a60c70866aa61b6367898 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'decoder')
-rw-r--r--decoder/Makefile.am1
-rw-r--r--decoder/incremental.cc2
-rw-r--r--decoder/scfg_translator.cc7
3 files changed, 8 insertions, 2 deletions
diff --git a/decoder/Makefile.am b/decoder/Makefile.am
index 00f8b5f9..914faaea 100644
--- a/decoder/Makefile.am
+++ b/decoder/Makefile.am
@@ -17,6 +17,7 @@ trule_test_SOURCES = trule_test.cc
trule_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a
cdec_SOURCES = cdec.cc
+cdec_LDFLAGS= -rdynamic
cdec_LDADD = libcdec.a ../mteval/libmteval.a ../utils/libutils.a ../klm/search/libksearch.a ../klm/lm/libklm.a ../klm/util/libklm_util.a ../klm/util/double-conversion/libklm_util_double.a
AM_CPPFLAGS = -DTEST_DATA=\"$(top_srcdir)/decoder/test_data\" -DBOOST_TEST_DYN_LINK -W -Wno-sign-compare -I$(top_srcdir) -I$(top_srcdir)/mteval -I$(top_srcdir)/utils -I$(top_srcdir)/klm
diff --git a/decoder/incremental.cc b/decoder/incremental.cc
index 85647a44..1537d61e 100644
--- a/decoder/incremental.cc
+++ b/decoder/incremental.cc
@@ -119,7 +119,7 @@ template <class Model> void Incremental<Model>::ConvertEdge(const search::Contex
float score = 0.0;
for (std::vector<WordID>::const_iterator word = e.begin(); word != e.end(); ++word) {
if (*word <= 0) {
- nts.push_back(vertices[in.tail_nodes_[-*word]].RootPartial());
+ nts.push_back(vertices[in.tail_nodes_[-*word]].RootAlternate());
if (nts.back().Empty()) return;
score += nts.back().Bound();
words.push_back(lm::kMaxWordIndex);
diff --git a/decoder/scfg_translator.cc b/decoder/scfg_translator.cc
index 3b43b586..6f0b003b 100644
--- a/decoder/scfg_translator.cc
+++ b/decoder/scfg_translator.cc
@@ -12,6 +12,7 @@
#include "grammar.h"
#include "bottom_up_parser.h"
#include "sentence_metadata.h"
+#include "stringlib.h"
#include "tdict.h"
#include "viterbi.h"
#include "verbose.h"
@@ -68,7 +69,11 @@ 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(new TRule("[" + cat + "] ||| " + src + " ||| " + src + " ||| PassThrough=1"));
+ int length = static_cast<int>(log(UTF8StringLen(src)) / log(1.6)) + 1;
+ if (length > 6) length = 6;
+ 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);