summaryrefslogtreecommitdiff
path: root/test.rb
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-03 17:11:43 +0200
committerPatrick Simianer <p@simianer.de>2014-06-03 17:11:43 +0200
commit7e965fce5245a79c2c8736b3f996198d09602b3b (patch)
treecab54433cbc96089a9684287f97674ce0464d200 /test.rb
parent3b0d4622865e71c49c4efc4db4ac35538a373a47 (diff)
getting serious
Diffstat (limited to 'test.rb')
-rwxr-xr-xtest.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test.rb b/test.rb
new file mode 100755
index 0000000..d2b8f66
--- /dev/null
+++ b/test.rb
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+
+require_relative 'hg'
+
+semiring = ViterbiSemiring.new
+hypergraph, nodes_by_label, _ = HG::read_hypergraph_from_json('example/json/test.json', semiring, true)
+path, score = HG::viterbi_path hypergraph, nodes_by_label['root'], semiring
+path.each { |e|
+ #puts e.to_s
+ puts " "+e.rule.to_s
+}
+s, score = HG::viterbi_string hypergraph, nodes_by_label['root'], semiring
+puts s
+
+