summaryrefslogtreecommitdiff
path: root/dtrain/scfg/features/count/test.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2011-09-04 23:40:44 +0200
committerPatrick Simianer <p@simianer.de>2011-09-23 19:13:58 +0200
commit809361a8e182c5e47ffe569db7671bc8c7224867 (patch)
treeb0c34f494be231962fdf7ec70eb739af64be0004 /dtrain/scfg/features/count/test.cc
parentaa5f96417ff81408b15b54aab35a3c16b845adf8 (diff)
minor updates, fixes, kbest filtering switch
Diffstat (limited to 'dtrain/scfg/features/count/test.cc')
-rw-r--r--dtrain/scfg/features/count/test.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/dtrain/scfg/features/count/test.cc b/dtrain/scfg/features/count/test.cc
new file mode 100644
index 00000000..46efe5d0
--- /dev/null
+++ b/dtrain/scfg/features/count/test.cc
@@ -0,0 +1,35 @@
+#include <string>
+#include <iostream>
+#include <vector>
+#include <boost/algorithm/string.hpp>
+
+using namespace std;
+using namespace boost;
+
+
+int main()
+{
+ string str="0:0 [X] ||| [X,1] musharrafs ||| [X,1] for musharraf ||| 1.78532981873 1.79239165783 0.301030009985 0.625125288963 1.95314443111 0.0 1.0 a=1 b=1 c=1 ||| 1-2";
+
+ size_t i = 0, c = 0, beg = 0, end = 0;
+ string::iterator it = str.begin();
+ string s;
+ while ( c != 12 ) {
+ s = *it;
+ if ( s == "|" ) c += 1;
+ if ( beg == 0 && c == 9 ) beg = i+2;
+ if ( c == 12 ) end = i-beg-3;
+ it++;
+ i++;
+ }
+
+ string sub = str.substr( beg, end );
+ vector<string> feats;
+ boost::split( feats, sub, boost::is_any_of(" ") );
+ vector<string>::iterator f;
+ for ( f = feats.begin(); f != feats.end(); f++ ) {
+ if ( f->find("=1") != string::npos ) cout << *f << endl;
+ }
+
+}
+