Sha256: fa07abc9894a5ddaf4225a38a94d1bcc8aa6aeb09073c413d2b8c079be6131b4

Contents?: true

Size: 941 Bytes

Versions: 1

Compression:

Stored size: 941 Bytes

Contents

module Opener
  class ChainedDaemon

    DEFAULT_OPTIONS = {
    }

    def initialize options = {}
      @options   = DEFAULT_OPTIONS.merge options
      @queue_map = {
      'opener-language-identifier':    Opener::LanguageIdentifier.new,
      'opener-tokenizer':              Opener::Tokenizer.new,
      'opener-pos-tagger':             Opener::POSTagger.new,
      'opener-polarity-tagger':        Opener::PolarityTagger.new,
      'opener-property-tagger':        Opener::PropertyTagger.new,
      'opener-ner':                    Opener::Ner.new,
      'opener-opinion-detector-basic': Opener::OpinionDetectorBasic.new,
    }
    end

    def run input
      output = nil
      @queue_map.each do |queue, component|
        File.write "input-#{queue}", input if ENV['DEBUG']
        output = component.run input
        input  = output
      end
      output
    rescue Core::UnsupportedLanguageError
      output
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opener-chained-daemon-1.0.2 lib/opener/chained_daemon/chained_daemon.rb