summaryrefslogtreecommitdiff
path: root/test.rb
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-04 19:31:38 +0200
committerPatrick Simianer <p@simianer.de>2014-06-04 19:31:38 +0200
commit6f1ed883692e7f9e082cadb92673e1eeed0cdc27 (patch)
treedcbc8381566d6e1f48a4496cc2953a168085e03d /test.rb
parent7e965fce5245a79c2c8736b3f996198d09602b3b (diff)
derive string, better grammar integration
Diffstat (limited to 'test.rb')
-rwxr-xr-xtest.rb13
1 files changed, 5 insertions, 8 deletions
diff --git a/test.rb b/test.rb
index d2b8f66..a1b07a8 100755
--- a/test.rb
+++ b/test.rb
@@ -2,14 +2,11 @@
require_relative 'hg'
+
+
semiring = ViterbiSemiring.new
hypergraph, nodes_by_label, _ = HG::read_hypergraph_from_json('example/json/test.json', semiring, true)
-path, score = HG::viterbi_path hypergraph, nodes_by_label['root'], semiring
-path.each { |e|
- #puts e.to_s
- puts " "+e.rule.to_s
-}
-s, score = HG::viterbi_string hypergraph, nodes_by_label['root'], semiring
-puts s
-
+path, _ = HG::viterbi_path hypergraph, nodes_by_label['root'], semiring
+s = HG::derive path, path.last.rule.lhs, []
+puts s.map { |i| i.word }.join ' '