Class: LLT::Review::Alignment::Word
- Inherits:
-
Object
- Object
- LLT::Review::Alignment::Word
- Includes:
- Core::Structures::HashContainable
- Defined in:
- lib/llt/review/alignment/word.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
Returns the value of attribute text.
Instance Method Summary collapse
-
#compare(other, diff_container) ⇒ Object
star is for additional params other classes like Treebank need.
- #nrefs ⇒ Object
- #report ⇒ Object
- #to_s ⇒ Object
- #translation ⇒ Object
Instance Attribute Details
#text ⇒ Object
Returns the value of attribute text.
6 7 8 |
# File 'lib/llt/review/alignment/word.rb', line 6 def text @text end |
Instance Method Details
#compare(other, diff_container) ⇒ Object
star is for additional params other classes like Treebank need
21 22 23 24 25 26 27 |
# 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 ⇒ Object
16 17 18 |
# File 'lib/llt/review/alignment/word.rb', line 16 def nrefs @container.keys.map(&:to_s).join(' ') end |
#report ⇒ Object
29 30 31 32 33 34 35 |
# 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 ⇒ Object
8 9 10 |
# File 'lib/llt/review/alignment/word.rb', line 8 def to_s @text end |
#translation ⇒ Object
12 13 14 |
# File 'lib/llt/review/alignment/word.rb', line 12 def translation @translation ||= @container.values.map(&:to_s).join(' ') end |