summaryrefslogtreecommitdiff
path: root/dtrain/dtrain.h
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2011-09-30 00:33:06 +0200
committerPatrick Simianer <p@simianer.de>2011-09-30 00:33:06 +0200
commit58f4ff5b79a545d59e21e77511a4b74c99b63d56 (patch)
tree5239aca8878eb6e6002fd7e983da041a6465dd34 /dtrain/dtrain.h
parent78fb5d2761551f4a1a4f4e8c19be88dc0348f3d9 (diff)
added iteration selection param
Diffstat (limited to 'dtrain/dtrain.h')
-rw-r--r--dtrain/dtrain.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/dtrain/dtrain.h b/dtrain/dtrain.h
index c1d910aa..34464e3c 100644
--- a/dtrain/dtrain.h
+++ b/dtrain/dtrain.h
@@ -24,6 +24,20 @@ inline void register_and_convert(const vector<string>& strs, vector<WordID>& ids
ids.push_back(TD::Convert(*it));
}
+inline string gettmpf(const string path, const string infix, const string suffix="") {
+ char fn[1024];
+ strcpy(fn, path.c_str());
+ strcat(fn, "/");
+ strcat(fn, infix.c_str());
+ strcat(fn, "-XXXXXX");
+ mkstemp(fn);
+ if (suffix != "") { // we will get 2 files
+ strcat(fn, ".");
+ strcat(fn, suffix.c_str());
+ }
+ return string(fn);
+}
+
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); }