summaryrefslogtreecommitdiff
path: root/test_hg.rb
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-18 13:26:05 +0200
committerPatrick Simianer <p@simianer.de>2014-06-18 13:26:05 +0200
commit33fda7f79c02b8ef152b88a11f3810c9a25a7381 (patch)
tree65e2bac0f08f7e24b1bb077126cd72343cc932ec /test_hg.rb
parent30109b5c6868bb3f638019ce099945a08f097d8f (diff)
integration
Diffstat (limited to 'test_hg.rb')
-rwxr-xr-xtest_hg.rb24
1 files changed, 0 insertions, 24 deletions
diff --git a/test_hg.rb b/test_hg.rb
deleted file mode 100755
index 14fe011..0000000
--- a/test_hg.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env ruby
-
-require_relative 'hg'
-
-
-# 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 ' '}"
-}
-