From d507c07dc60af01a0897df1c6f34df7089cbbd69 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Mon, 28 Sep 2015 09:50:03 +0200
Subject: output viterbi tree
---
training/dtrain/dtrain_net_interface.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
(limited to 'training/dtrain/dtrain_net_interface.cc')
diff --git a/training/dtrain/dtrain_net_interface.cc b/training/dtrain/dtrain_net_interface.cc
index 38fad160..e21920d0 100644
--- a/training/dtrain/dtrain_net_interface.cc
+++ b/training/dtrain/dtrain_net_interface.cc
@@ -27,6 +27,7 @@ main(int argc, char** argv)
vector dense_features;
boost::split(dense_features, conf["dense_features"].as(),
boost::is_any_of(" "));
+ const bool output_derivation = conf["output_derivation"].as();
// setup decoder
register_feature_functions();
@@ -125,7 +126,11 @@ main(int argc, char** argv)
vector* samples = observer->GetSamples();
ostringstream os;
cerr << "[dtrain] 1best features " << (*samples)[0].f << endl;
- PrintWordIDVec((*samples)[0].w, os);
+ if (output_derivation) {
+ os << observer->GetViterbiTreeString() << endl;
+ } else {
+ PrintWordIDVec((*samples)[0].w, os);
+ }
sock.send(os.str().c_str(), os.str().size()+1, 0);
cerr << "[dtrain] done translating, looping again" << endl;
continue;
--
cgit v1.2.3