Class: Opener::KAF::Term
- Inherits:
-
Object
- Object
- Opener::KAF::Term
- Defined in:
- lib/opener/kaf/term.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(document, node) ⇒ Term
constructor
A new instance of Term.
- #lemma ⇒ Object
- #pos ⇒ Object
- #setPolarity(attrs, polarity_pos) ⇒ Object
Constructor Details
#initialize(document, node) ⇒ Term
Returns a new instance of Term.
8 9 10 11 |
# File 'lib/opener/kaf/term.rb', line 8 def initialize document, node @document = document @node = node end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
5 6 7 |
# File 'lib/opener/kaf/term.rb', line 5 def document @document end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
6 7 8 |
# File 'lib/opener/kaf/term.rb', line 6 def node @node end |
Instance Method Details
#id ⇒ Object
13 14 15 |
# File 'lib/opener/kaf/term.rb', line 13 def id @id ||= @node.attr :tid end |
#lemma ⇒ Object
17 18 19 |
# File 'lib/opener/kaf/term.rb', line 17 def lemma @node.attr :lemma end |
#pos ⇒ Object
21 22 23 |
# File 'lib/opener/kaf/term.rb', line 21 def pos @node.attr :pos end |
#setPolarity(attrs, polarity_pos) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/opener/kaf/term.rb', line 25 def setPolarity attrs, polarity_pos #In case there is no pos info, we use the polarityPos @node[:pos] = polarity_pos if !pos and polarity_pos sentiment = @node.add_child('<sentiment/>') sentiment.attr attrs end |