summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2016-06-17 14:10:27 +0200
committerPatrick Simianer <p@simianer.de>2016-06-17 14:10:27 +0200
commita4ed068456395063add9edaa341e19976ffeccac (patch)
treeebd648cd680f6444633639d799bb0ab5870b8c31
parent8a2e23edc4815ba6b113fda059dc2ddaeaf001f5 (diff)
rm
-rwxr-xr-xprototype/new_obj.rb34
1 files changed, 0 insertions, 34 deletions
diff --git a/prototype/new_obj.rb b/prototype/new_obj.rb
deleted file mode 100755
index 3380fd0..0000000
--- a/prototype/new_obj.rb
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/env ruby
-
-require_relative 'hypergraph'
-
-class NewObjSemiring < Semiring
- def initialize
- @add = Proc.new { |a,b| [a,b].min }
- @multiply = Proc.new { |a,b| a*b }
- @one = 1.0
- @null = 0.0
- @convert = Proc.new { |v| v }
- end
-end
-
-def main
- #semiring = NewObjSemiring.new
- semiring = ViterbiSemiring.new
- #h = { "logp" => 0, "use_house" => 100, "use_small" => 100 }
- #model = [[1, SparseVector.from_h(h)]]
- hypergraph, nodes_by_id = HG::read_hypergraph_from_json('739.json.gz', semiring, true)
- path, score = HG::viterbi_path hypergraph, nodes_by_id[-1], semiring
- path.each { |e| puts "#{e.head.to_s}\t#{e.rule.to_s}" }
- puts path.size
- puts "---"
- s = HG::derive path, path.last.head, []
- puts s.size
- puts "#{s.map { |i| i.word }.join ' '}"
- puts Math.log(score)
- puts
-
-end
-
-main
-