Class: LLT::Review::Treebank::Word
- Inherits:
-
Object
- Object
- LLT::Review::Treebank::Word
- Includes:
- Core::Structures::HashContainable
- Defined in:
- lib/llt/review/treebank/word.rb
Defined Under Namespace
Classes: Attr
Constant Summary collapse
- COMPARABLE_ELEMENTS =
%i{ lemma postag head relation }
Instance Attribute Summary collapse
-
#form ⇒ Object
Returns the value of attribute form.
-
#head ⇒ Object
Returns the value of attribute head.
-
#inexistant ⇒ Object
Returns the value of attribute inexistant.
-
#lemma ⇒ Object
Returns the value of attribute lemma.
-
#postag ⇒ Object
Returns the value of attribute postag.
-
#relation ⇒ Object
Returns the value of attribute relation.
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &blk) ⇒ Object (private)
used when parsers try to check in attributes we are not interested in
52 53 54 |
# File 'lib/llt/review/treebank/word.rb', line 52 def method_missing(meth, *args, &blk) super unless meth =~ /=$/ end |
Instance Attribute Details
#form ⇒ Object
Returns the value of attribute form.
6 7 8 |
# File 'lib/llt/review/treebank/word.rb', line 6 def form @form end |
#head ⇒ Object
Returns the value of attribute head.
6 7 8 |
# File 'lib/llt/review/treebank/word.rb', line 6 def head @head end |
#inexistant ⇒ Object
Returns the value of attribute inexistant.
6 7 8 |
# File 'lib/llt/review/treebank/word.rb', line 6 def inexistant @inexistant end |
#lemma ⇒ Object
Returns the value of attribute lemma.
6 7 8 |
# File 'lib/llt/review/treebank/word.rb', line 6 def lemma @lemma end |
#postag ⇒ Object
Returns the value of attribute postag.
7 8 9 |
# File 'lib/llt/review/treebank/word.rb', line 7 def postag @postag end |
#relation ⇒ Object
Returns the value of attribute relation.
6 7 8 |
# File 'lib/llt/review/treebank/word.rb', line 6 def relation @relation end |
Instance Method Details
#[](key) ⇒ Object
23 24 25 |
# File 'lib/llt/review/treebank/word.rb', line 23 def [](key) super(key) || send("#{key}=", '-') end |
#compare(other, diff_container, comparables) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# 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 |