summaryrefslogtreecommitdiff
path: root/test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test.rb')
-rwxr-xr-xtest.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/test.rb b/test.rb
index d9fbdfa..e65c9b3 100755
--- a/test.rb
+++ b/test.rb
@@ -5,14 +5,15 @@ require_relative 'hg'
semiring = ViterbiSemiring.new
hypergraph, nodes_by_id = HG::read_hypergraph_from_json('example/json/test.json', semiring, true)
-#path, score = HG::viterbi_path hypergraph, nodes_by_id[-1], semiring
-#s = HG::derive path, path.last.rule.lhs, []
-#puts "#{s.map { |i| i.word }.join ' '} ||| #{score}"
+path, score = HG::viterbi_path hypergraph, nodes_by_id[-1], semiring
+s = HG::derive path, path.last.head, []
+puts "#{s.map { |i| i.word }.join ' '}"
+puts
hypergraph.reset
paths = HG::all_paths hypergraph, nodes_by_id[-1]
paths.each { |p|
- s = HG::derive p, p.last.rule.lhs, []
+ s = HG::derive p, p.last.head, []
puts "#{s.map { |i| i.word }.join ' '}"
}