diff options
author | Patrick Simianer <p@simianer.de> | 2014-06-18 16:19:32 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-06-18 16:19:32 +0200 |
commit | f9106c8353aeaf6456a3eb0ea0c1e429f5de7650 (patch) | |
tree | 9b4c2baad153d189821633ef6649647d0992a1fa /test/hg.rb | |
parent | 33fda7f79c02b8ef152b88a11f3810c9a25a7381 (diff) |
integration
Diffstat (limited to 'test/hg.rb')
-rwxr-xr-x | test/hg.rb | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/test/hg.rb b/test/hg.rb deleted file mode 100755 index 16e6b6f..0000000 --- a/test/hg.rb +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env ruby - -require_relative '../hg' - - -def main - # viterbi - semiring = ViterbiSemiring.new - hypergraph, nodes_by_id = HG::read_hypergraph_from_json('../example/toy/toy.json', semiring, true) - #hypergraph, nodes_by_id = HG::read_hypergraph_from_json('../example/glue/glue.json', semiring, true) - #hypergraph, nodes_by_id = HG::read_hypergraph_from_json('../example/3/3.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 Math.log score - puts - - # all paths - hypergraph.reset - paths = HG::all_paths hypergraph, nodes_by_id[-1] - paths.each_with_index { |p,i| - s = HG::derive p, p.last.head, [] - puts "#{i+1}. #{s.map { |x| x.word }.join ' '}" - } -end - - -main - |