class LLT::Review::Alignment::Word

Attributes

text[RW]

Public Instance Methods

compare(other, diff_container, *) click to toggle source

star is for additional params other classes like Treebank need

# File lib/llt/review/alignment/word.rb, line 21
def compare(other, diff_container, *)
  unless translation == other.translation
    d = diff_container[id] ||= Difference::Word.new(self)
    d.add(Difference::Translation.new(translation, other.translation))
    d.add(Difference::Nrefs.new(nrefs, other.nrefs))
  end
end
nrefs() click to toggle source
# File lib/llt/review/alignment/word.rb, line 16
def nrefs
  @container.keys.map(&:to_s).join(' ')
end
report() click to toggle source
# File lib/llt/review/alignment/word.rb, line 29
def report
  @report ||= begin
    rep = Report::Word.new(@text)
    rep.add(Report::Translation.new(translation))
    rep
  end
end
to_s() click to toggle source
# File lib/llt/review/alignment/word.rb, line 8
def to_s
  @text
end
translation() click to toggle source
# File lib/llt/review/alignment/word.rb, line 12
def translation
  @translation ||= @container.values.map(&:to_s).join(' ')
end