summaryrefslogtreecommitdiff
path: root/test_hg.rb
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-07 12:31:02 +0200
committerPatrick Simianer <p@simianer.de>2014-06-07 12:31:02 +0200
commit1298b37784247d6de486814838b07ddcf69cd970 (patch)
treed6626351e36518b9e14d557bbcec2ac29235c59e /test_hg.rb
parent24e296e97c32fdf6c3b7fd5ecb5596165d4dad14 (diff)
fix reordering
Diffstat (limited to 'test_hg.rb')
-rwxr-xr-xtest_hg.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test_hg.rb b/test_hg.rb
new file mode 100755
index 0000000..e65c9b3
--- /dev/null
+++ b/test_hg.rb
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+
+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.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.head, []
+ puts "#{s.map { |i| i.word }.join ' '}"
+}
+