lib/opener/opinion_detector_basic/kaf/document.rb
##
# Adds the entire opinion in the KAF file.
#
Adds the entire opinion in the KAF file.
Adds the entire opinion in the KAF file .
def add_opinion opinion, index
          opinion_node = new_node 'opinion', 'KAF/opinions'
          opinion_node['oid'] = "o#{index.to_s}"
          if opinion.holders.present?
            opinion_holder_node = new_node 'opinion_holder', opinion_node
            add_opinion_element opinion_holder_node, opinion.holders
          end
          opinion_target_node = new_node 'opinion_target', opinion_node
          if opinion.target_ids.present?
            add_opinion_element opinion_target_node, opinion.target_ids
          end
          expression_node = new_node 'opinion_expression', opinion_node
          expression_node['polarity'] = opinion.polarity
          expression_node['strength'] = opinion.strength.to_s
          expression_node['lexicon-id'] = opinion.lexicon_id if opinion.lexicon_id
          add_opinion_element expression_node, opinion.ids
        end
def add_opinion opinion , index opinion_node = new_node 'opinion' , 'KAF/opinions' opinion_node [ 'oid' ] = "o#{index.to_s}" if opinion . holders . present? opinion_holder_node = new_node 'opinion_holder' , opinion_node add_opinion_element opinion_holder_node , opinion . holders end opinion_target_node = new_node 'opinion_target' , opinion_node if opinion . target_ids . present? add_opinion_element opinion_target_node , opinion . target_ids end expression_node = new_node 'opinion_expression' , opinion_node expression_node [ 'polarity' ] = opinion . polarity expression_node [ 'strength' ] = opinion . strength . to_s expression_node [ 'lexicon-id' ] = opinion . lexicon_id if opinion . lexicon_id add_opinion_element expression_node , opinion . ids end
Adds the entire opinion in the KAF file.
Adds the entire opinion in the KAF file .
opinion
<not_specific>
index
<not_specific>