Sha256: f2f9387c57f8fa14eed8e693dc820c8e8ad16f4bb20d4fe86a44b5dc2d4c4881

Contents?: true

Size: 1.4 KB

Versions: 5

Compression:

Stored size: 1.4 KB

Contents

gem 'slop', '~> 3.0'

require 'active_support/all'

require 'slop'
require 'hashie'
require 'nokogiri'

require 'rexml/document'
require 'rexml/formatters/pretty'

require_relative 'opinion_detector_basic/kaf/document'
require_relative 'opinion_detector_basic/kaf/term'
require_relative 'opinion_detector_basic/kaf/opinion'

require_relative 'opinion_detector_basic/version'
require_relative 'opinion_detector_basic/cli'
require_relative 'opinion_detector_basic/base_processor'
require_relative 'opinion_detector_basic/processor'
require_relative 'opinion_detector_basic/legacy_processor'

module Opener
  ##
  # Rule based opinion detector.
  #
  # @!attribute [r] args
  #  @return [Array]
  #
  # @!attribute [r] options
  #  @return [Hash]
  #
  class OpinionDetectorBasic
    attr_reader :args, :options

    ##
    # @param [Hash] options
    #
    # @option options [Array] :args Command-line arguments to pass to the
    #  underlying Python kernel.
    #
    def initialize(options = {})
      @args    = options.delete(:args) || []
      @options = options
      ENV['OPINION_LEGACY'] = 'true' # Processor is still not working
      @klass   = if ENV['OPINION_LEGACY'] then LegacyProcessor else Processor end
    end

    ##
    # Processes the input KAF document.
    #
    # @param [String] input
    # @return [String]
    #
    def run input, params = {}
      @klass.new(input, options).process
    end

  end
end


Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opener-opinion-detector-basic-3.3.0 lib/opener/opinion_detector_basic.rb
opener-opinion-detector-basic-3.2.8 lib/opener/opinion_detector_basic.rb
opener-opinion-detector-basic-3.2.7 lib/opener/opinion_detector_basic.rb
opener-opinion-detector-basic-3.2.6 lib/opener/opinion_detector_basic.rb
opener-opinion-detector-basic-3.2.5 lib/opener/opinion_detector_basic.rb