Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAles Tamchyna <tamchyna@ufal.mff.cuni.cz>2015-01-06 17:19:34 +0300
committerAles Tamchyna <tamchyna@ufal.mff.cuni.cz>2015-01-06 17:19:34 +0300
commite864a8d8df56740feb406fc005e3e50bae414191 (patch)
tree8749fe8a35417a78345a2394293594173c4b3285 /moses/Util.h
parentd84094a4e0216257f12185b98d9486597e64d347 (diff)
another utility function
Diffstat (limited to 'moses/Util.h')
-rw-r--r--moses/Util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/moses/Util.h b/moses/Util.h
index a595e9a3f..12038468e 100644
--- a/moses/Util.h
+++ b/moses/Util.h
@@ -331,6 +331,20 @@ std::string Join(const std::string& delimiter, const std::vector<T>& items)
return outstr.str();
}
+/*
+ * Convert any container to string
+ */
+template<typename It>
+std::string Join(const std::string &delim, It begin, It end)
+{
+ std::ostringstream outstr;
+ if (begin != end)
+ outstr << *begin++;
+ for ( ; begin != end; ++begin)
+ outstr << delim << *begin;
+ return outstr.str();
+}
+
//! transform prob to natural log score
inline float TransformScore(float prob)
{