summaryrefslogtreecommitdiff
path: root/test/parse.rb
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-18 16:19:32 +0200
committerPatrick Simianer <p@simianer.de>2014-06-18 16:19:32 +0200
commitf9106c8353aeaf6456a3eb0ea0c1e429f5de7650 (patch)
tree9b4c2baad153d189821633ef6649647d0992a1fa /test/parse.rb
parent33fda7f79c02b8ef152b88a11f3810c9a25a7381 (diff)
integration
Diffstat (limited to 'test/parse.rb')
-rwxr-xr-xtest/parse.rb47
1 files changed, 0 insertions, 47 deletions
diff --git a/test/parse.rb b/test/parse.rb
deleted file mode 100755
index e139ea4..0000000
--- a/test/parse.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env ruby
-
-require_relative '../parse'
-
-
-def main
- STDERR.write "> reading input from TODO\n"
- input = 'ich sah ein kleines haus'.split
- #input = 'lebensmittel schuld an europäischer inflation'.split
- #input = 'offizielle prognosen sind von nur 3 prozent ausgegangen , meldete bloomberg .'.split
- n = input.size
-
- STDERR.write "> reading grammar\n"
- grammar = Grammar::Grammar.new '../example/toy/grammar'
- #grammar = Grammar::Grammar.new '../example/glue/grammar'
- #grammar = Grammar::Grammar.new '../example/3/grammar.3.gz'
-
- STDERR.write ">> adding glue grammar\n"
- #grammar.add_glue_rules
-
- STDERR.write ">> adding pass-through grammar\n"
- #grammar.add_pass_through_rules input
-
- STDERR.write "> initializing charts\n"
- passive_chart = Parse::Chart.new n
- active_chart = Parse::Chart.new n
- Parse::init input, n, active_chart, passive_chart, grammar
-
- STDERR.write "> parsing\n"
- Parse::parse input, n, active_chart, passive_chart, grammar
-
- puts "\n---\npassive chart"
- Parse::visit(1, 0, 5) { |i,j| puts "#{i},#{j}"; passive_chart.at(i,j).each { |item| puts " #{j} #{item.to_s}" }; puts }
-
- weights_file = '../example/toy/weights'
- #weights_file = '../example/glue/weights'
- #weights_file = '../example/3/weights.init'
- weights = SparseVector.from_kv(ReadFile.read(weights_file), ' ', "\n")
- if !weights
- weights = SparseVector.new
- end
- puts passive_chart.to_json weights
-end
-
-
-main
-