summaryrefslogtreecommitdiff
path: root/src/fast_weaver.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-09-16 10:23:14 +0100
committerPatrick Simianer <p@simianer.de>2014-09-16 10:23:14 +0100
commit129a22cfcc7651daa4b11ed52e7870249f6373a5 (patch)
tree78de4649396ab0d37a325b7598f9873c2d65f4c9 /src/fast_weaver.cc
parentdf70006a07fb67b17fb39aa56762c50c2e7b8131 (diff)
spring cleaning
Diffstat (limited to 'src/fast_weaver.cc')
-rw-r--r--src/fast_weaver.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/fast_weaver.cc b/src/fast_weaver.cc
new file mode 100644
index 0000000..4854476
--- /dev/null
+++ b/src/fast_weaver.cc
@@ -0,0 +1,26 @@
+#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]);
+ //Hg::io::manual(hg, g.rules);
+ 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;
+}
+