class Treebank::EllipticWord
Public Class Methods
new(word_node, sentence)
click to toggle source
# File lib/treebank/elliptic_word.rb, line 3 def initialize(word_node, sentence) @node = word_node @sentence = sentence end
Public Instance Methods
parse_elliptic_head()
click to toggle source
# File lib/treebank/elliptic_word.rb, line 8 def parse_elliptic_head return unless match = @node['relation'].match(regexp) label, elliptic_string, elliptic_label = match.captures elliptic_head = @node['head'] unless head = @sentence.elliptic_nodes[elliptic_string] new_node = create_new_node(elliptic_head, elliptic_label, elliptic_string) head = new_node['id'] end @node['relation'] = label @node['head'] = head end
Private Instance Methods
create_new_node(head, label, string)
click to toggle source
# File lib/treebank/elliptic_word.rb, line 25 def create_new_node(head, label, string) new_node = @sentence.add_ellipsis({ artificial: 'elliptic', head: head, relation: label, }, string) new_word = EllipticWord.new(new_node, @sentence) new_word.parse_elliptic_head new_node end
regexp()
click to toggle source
# File lib/treebank/elliptic_word.rb, line 38 def regexp /(\w+?)_ExD(\d+)_(.+)/ end