class Corenlp::Sentence

Attributes

index[RW]
parse_tree_raw[RW]
token_dependencies[RW]
tokens[RW]

Public Class Methods

new(attrs = {}) click to toggle source
# File lib/corenlp/sentence.rb, line 5
def initialize(attrs = {})
  @index = attrs[:index]
  @tokens = []
  @token_dependencies = []
  @parse_tree_raw = ''
end

Public Instance Methods

get_dependency_token_by_index(index) click to toggle source
# File lib/corenlp/sentence.rb, line 24
def get_dependency_token_by_index(index)
  tokens.detect{|t| t.index == index}
end
governor_dependencies(token) click to toggle source
# File lib/corenlp/sentence.rb, line 12
def governor_dependencies(token)
  token_dependencies.select{|td| td.governor == token}
end
next_token(token) click to toggle source
# File lib/corenlp/sentence.rb, line 16
def next_token(token)
  tokens.sort_by(&:index).detect{|t| t.index > token.index}
end
previous_token(token) click to toggle source
# File lib/corenlp/sentence.rb, line 20
def previous_token(token)
  tokens.sort_by(&:index).reverse.detect{|t| t.index < token.index}
end