summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-03-23 11:03:11 +0100
committerPatrick Simianer <p@simianer.de>2015-03-23 11:03:11 +0100
commitf2989ef661bdb73eabee174ba5c956e2aba5540c (patch)
treeeacbb1dea04901cd2c1bda4f61346da78167add3
parente84265273b121eb5fbf465b80ea39d43602703fe (diff)
misc changes
-rw-r--r--src/fast_weaver.cc21
-rw-r--r--src/grammar.hh2
-rw-r--r--src/parse.hh2
3 files changed, 19 insertions, 6 deletions
diff --git a/src/fast_weaver.cc b/src/fast_weaver.cc
index 81740e5..bdf21f8 100644
--- a/src/fast_weaver.cc
+++ b/src/fast_weaver.cc
@@ -4,22 +4,35 @@
int
main(int argc, char** argv)
{
+ clock_t begin_total = clock();
+
+ // read hg
+ clock_t begin_read = clock();
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 end_read = clock();
+ double elapsed_secs_read = double(end_read - begin_read) / CLOCKS_PER_SEC;
+ cerr << "read " << elapsed_secs_read << " s" << endl;
+
+ // viterbi
+ clock_t begin_viterbi = clock();
Hg::Path p;
Hg::viterbi_path(hg, p);
vector<string> s;
- clock_t begin = clock();
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;
+ clock_t end_viterbi = clock();
+ double elapsed_secs_viterbi = double(end_viterbi - begin_viterbi) / CLOCKS_PER_SEC;
+ cerr << "viterbi " << elapsed_secs_viterbi << " s" << endl;
+
+ clock_t end_total = clock();
+ double elapsed_secs = double(end_total - begin_total) / CLOCKS_PER_SEC;
+ cerr << "total " << elapsed_secs << " s" << endl;
return 0;
}
diff --git a/src/grammar.hh b/src/grammar.hh
index 51a72fa..bc587d9 100644
--- a/src/grammar.hh
+++ b/src/grammar.hh
@@ -194,7 +194,7 @@ Sv::SparseVector<string, score_t>* f;
r->target.push_back(item);
} else if (j == 3) { // feature vector
Sv::SparseVector<string, score_t>::from_s(r->f, buf);
- // FIXME: this is slow!!! ^^^
+ // FIXME: this is slow!!!
} else if (j == 4) { // alignment
} else {
// error
diff --git a/src/parse.hh b/src/parse.hh
index 6e7883a..2920541 100644
--- a/src/parse.hh
+++ b/src/parse.hh
@@ -206,7 +206,7 @@ parse(vector<symbol_t> const& in, size_t n, Chart& active, Chart& passive, G::Gr
ChartItem* item = active.at(span).back();
active.at(span).pop_back();
while (item->rule->rhs[item->dot]->type() == G::NON_TERMINAL) {
- symbol_t cur_sym = item->rule->rhs[item->dot]->symbol();
+ symbol_t cur_sym = item->rule->rhs[item->dot]->symbol();
}
}