From f6994142f7b6a874e8fb62fa279816d8d6e9eab1 Mon Sep 17 00:00:00 2001 From: graehl Date: Thu, 1 Jul 2010 23:08:34 +0000 Subject: factor forest stats (show size post pruning, and portion kept) and cdec --scale_prune_srclen git-svn-id: https://ws10smt.googlecode.com/svn/trunk@96 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/stringlib.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'decoder/stringlib.h') diff --git a/decoder/stringlib.h b/decoder/stringlib.h index 76efee8f..22863945 100644 --- a/decoder/stringlib.h +++ b/decoder/stringlib.h @@ -36,6 +36,13 @@ inline void Tokenize(const std::string& str, char delimiter, std::vectorpush_back(&s[last]); } +inline unsigned NTokens(const std::string& str, char delimiter) +{ + std::vector r; + Tokenize(str,delimiter,&r); + return r.size(); +} + inline std::string LowercaseString(const std::string& in) { std::string res(in.size(),' '); for (int i = 0; i < in.size(); ++i) -- cgit v1.2.3