Sha256: ded73d718a67e55daa922b1928bd14709a80d4ba5e68aa0786bc6c2aa16912d3

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

module Opener
  module KAF
    class Term

      attr_reader :document
      attr_reader :node

      def initialize document, node
        @document = document
        @node     = node
      end

      def id
        @id ||= @node.attr :tid
      end

      def lemma
        @node.attr :lemma
      end

      def text
        @node.attr :text
      end

      def pos
        @node.attr :pos
      end

      def lexicon_id
        @node.attr :lexicon_id
      end

      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

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opener-polarity-tagger-3.5.5 lib/opener/kaf/term.rb
opener-polarity-tagger-3.5.4 lib/opener/kaf/term.rb