From 5584f300821e20369c25343222cd0e8faa393523 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Sat, 24 Sep 2011 04:45:22 +0200
Subject: get rid of boost str split, more tweaks
---
dtrain/dtrain.h | 69 +++++++++++++++++++++++++++------------------------------
1 file changed, 33 insertions(+), 36 deletions(-)
(limited to 'dtrain/dtrain.h')
diff --git a/dtrain/dtrain.h b/dtrain/dtrain.h
index 3d319233..9bc5be93 100644
--- a/dtrain/dtrain.h
+++ b/dtrain/dtrain.h
@@ -2,59 +2,56 @@
#define _DTRAIN_COMMON_H_
-#include
-#include
-#include
-#include
-#include
#include
-// cdec includes
-#include "sentence_metadata.h"
+#include
+#include
+
#include "verbose.h"
#include "viterbi.h"
-#include "kbest.h"
#include "ff_register.h"
#include "decoder.h"
#include "weights.h"
-// boost includes
-#include
-#include
-
-// own headers
#include "score.h"
-
-#define DTRAIN_DEFAULT_K 100 // k for kbest lists
-#define DTRAIN_DEFAULT_N 4 // N for ngrams (e.g. BLEU)
-#define DTRAIN_DEFAULT_T 1 // iterations
-#define DTRAIN_DEFAULT_SCORER "stupid_bleu" // scorer
-#define DTRAIN_DOTS 100 // when to display a '.'
-#define DTRAIN_TMP_DIR "/tmp" // put this on a SSD?
-#define DTRAIN_GRAMMAR_DELIM "########EOS########"
-
-
#include "kbestget.h"
-#include "pairsampling.h"
-
#include "ksampler.h"
+#include "pairsampling.h"
-// boost compression
-#include
-#include
-#include
-//#include
-//#include
-using namespace boost::iostreams;
-
-#include
-#include
-
+#define DTRAIN_DOTS 100 // when to display a '.'
+#define DTRAIN_TMP_DIR "/var/hadoop/mapred/local" // put this on a SSD?
+#define DTRAIN_GRAMMAR_DELIM "########EOS########"
using namespace std;
using namespace dtrain;
namespace po = boost::program_options;
+inline void register_and_convert(const vector& strs, vector& ids) {
+ vector::const_iterator it;
+ for (it = strs.begin(); it < strs.end(); it++)
+ ids.push_back(TD::Convert(*it));
+}
+inline ostream& _np(ostream& out) { return out << resetiosflags(ios::showpos); }
+inline ostream& _p(ostream& out) { return out << setiosflags(ios::showpos); }
+inline ostream& _p2(ostream& out) { return out << setprecision(2); }
+inline ostream& _p5(ostream& out) { return out << setprecision(5); }
+inline ostream& _p9(ostream& out) { return out << setprecision(9); }
+inline void strsplit(string &s, vector& v, char d = '\t', size_t parts = 0) {
+ stringstream ss(s);
+ string t;
+ size_t c = 0;
+ while(true)
+ {
+ if (parts > 0 && c == parts-1) {
+ getline(ss, t);
+ v.push_back(t);
+ break;
+ }
+ if (!getline(ss, t, d)) break;
+ v.push_back(t);
+ c++;
+ }
+}
#endif
--
cgit v1.2.3