From 1298b37784247d6de486814838b07ddcf69cd970 Mon Sep 17 00:00:00 2001 From: Patrick Simianer
Date: Sat, 7 Jun 2014 12:31:02 +0200 Subject: fix reordering --- test_hg.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 test_hg.rb (limited to 'test_hg.rb') 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 ' '}" +} + -- cgit v1.2.3