class LLT::Review::Treebank::Word

Constants

Attr
COMPARABLE_ELEMENTS

Attributes

form[RW]
head[RW]
inexistant[RW]
lemma[RW]
postag[R]
relation[RW]

Public Instance Methods

[](key) click to toggle source
Calls superclass method
# File lib/llt/review/treebank/word.rb, line 23
def [](key)
  super(key) || send("#{key}=", '-')
end
compare(other, diff_container, comparables) click to toggle source
# File lib/llt/review/treebank/word.rb, line 33
def compare(other, diff_container, comparables)
  comparables = COMPARABLE_ELEMENTS unless comparables # default value
  comparables.each do |comparator|
    a, b = [self, other].map { |w| w[comparator].to_s }
    if a != b
      d = diff_container[id] ||= Difference::Word.new(self)
      d.add(new_difference(comparator, a, b))
    end
  end
end
postag=(tag) click to toggle source
# File lib/llt/review/treebank/word.rb, line 27
def postag=(tag)
  add(Postag.new(tag))
end

Private Instance Methods

method_missing(meth, *args, &blk) click to toggle source

used when parsers try to check in attributes we are not interested in

Calls superclass method
# File lib/llt/review/treebank/word.rb, line 52
def method_missing(meth, *args, &blk)
  super unless meth =~ /=$/
end
new_difference(comparator, original, new) click to toggle source
# File lib/llt/review/treebank/word.rb, line 46
def new_difference(comparator, original, new)
  klass = Difference.const_get(comparator.capitalize)
  klass.new(self[comparator], original, new)
end