class TextRazor::Phrase
Attributes
id[R]
text[R]
Public Class Methods
create_from_hash(params, words)
click to toggle source
# File lib/textrazor/phrase.rb, line 12 def self.create_from_hash(params, words) new(params, words) end
new(params, words)
click to toggle source
# File lib/textrazor/phrase.rb, line 7 def initialize(params, words) @id = params["id"] @text = match_words(params["wordPositions"], words) end
Public Instance Methods
match_words(positions, words)
click to toggle source
# File lib/textrazor/phrase.rb, line 16 def match_words(positions, words) phrase = [] positions.each { |position| phrase.push words[position].token } phrase.join(' ') end