summaryrefslogtreecommitdiff
path: root/test/test_hg.rb
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-09-16 10:23:14 +0100
committerPatrick Simianer <p@simianer.de>2014-09-16 10:23:14 +0100
commit129a22cfcc7651daa4b11ed52e7870249f6373a5 (patch)
tree78de4649396ab0d37a325b7598f9873c2d65f4c9 /test/test_hg.rb
parentdf70006a07fb67b17fb39aa56762c50c2e7b8131 (diff)
spring cleaning
Diffstat (limited to 'test/test_hg.rb')
-rwxr-xr-xtest/test_hg.rb32
1 files changed, 0 insertions, 32 deletions
diff --git a/test/test_hg.rb b/test/test_hg.rb
deleted file mode 100755
index 6311bac..0000000
--- a/test/test_hg.rb
+++ /dev/null
@@ -1,32 +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/toy/toy-test.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, []
- path.each { |e| puts "#{e.rule}" }
- puts "---"
- 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
-