summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-01-14 19:08:41 +0100
committerPatrick Simianer <p@simianer.de>2015-01-14 19:08:41 +0100
commit9bb2638ce40de809b4d15cae6a7dda4e46c2b5f9 (patch)
tree14796cad5aca6df83d80a464a4a07682223862ba
parent6b5d8430d2cc6337a897bd7ace1a7d57cd211c14 (diff)
test hypergraph
-rw-r--r--src/test_hypergraph.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test_hypergraph.cc b/src/test_hypergraph.cc
new file mode 100644
index 0000000..ac87bce
--- /dev/null
+++ b/src/test_hypergraph.cc
@@ -0,0 +1,28 @@
+#include "hypergraph.hh"
+#include <ctime>
+
+int
+main(int argc, char** argv)
+{
+ Hg::Hypergraph hg;
+ G::Vocabulary y;
+ G::Grammar g;
+ Hg::io::read(hg, g.rules, y, argv[1]);
+
+ clock_t begin = clock();
+ Hg::Path p;
+ Hg::viterbi_path(hg, p);
+ vector<string> s;
+ Hg::derive(p, p.back()->head, s);
+
+ for (auto it: s)
+ cout << it << " ";
+ cout << endl;
+
+ clock_t end = clock();
+ double elapsed_secs = double(end - begin) / CLOCKS_PER_SEC;
+ cout << elapsed_secs << " s" << endl;
+
+ return 0;
+}
+