From a4ed068456395063add9edaa341e19976ffeccac Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Fri, 17 Jun 2016 14:10:27 +0200 Subject: rm --- prototype/new_obj.rb | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100755 prototype/new_obj.rb (limited to 'prototype') 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 - -- cgit v1.2.3