From a981df066484f799637c8a0b88209110038e3148 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Thu, 12 Jun 2014 11:22:44 +0200 Subject: feature vectors --- parse.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'parse.rb') diff --git a/parse.rb b/parse.rb index 598aade..454bb14 100644 --- a/parse.rb +++ b/parse.rb @@ -33,7 +33,7 @@ end Span = Struct.new(:left, :right) class Item < Grammar::Rule - attr_accessor :left, :right, :tail_spans, :dot + attr_accessor :left, :right, :tail_spans, :dot, :f def initialize rule_or_item, left, right, dot @lhs = Grammar::NT.new(rule_or_item.lhs.symbol, rule_or_item.lhs.index) @@ -41,6 +41,7 @@ class Item < Grammar::Rule @right = right @rhs = [] @tail_spans = {} + @f = rule_or_item.f @map = (rule_or_item.map ? rule_or_item.map.dup : []) rule_or_item.rhs.each_with_index { |x,i| if x.class == Grammar::T -- cgit v1.2.3