Sha256: 49d672811fc587982aaa0a395b3cd639e8715341cb5bd901cba21e460736ac6b

Contents?: true

Size: 800 Bytes

Versions: 2

Compression:

Stored size: 800 Bytes

Contents

module Boilerpipe
  java_import java.net.URL

  module Extractors
    class ArticleExtractor
      java_import 'com.kohlschutter.boilerpipe.extractors.ArticleExtractor'

      def self.process(doc)
        ArticleExtractor::INSTANCE.process doc
      end

      def  self.get_text(s)
        url = nil

        begin
          url = Java::JavaNet::URL.new(s)
        rescue Java::JavaNet::MalformedURLException => e
          # not a URL
        end
        input = url ? url : s
        ArticleExtractor::INSTANCE.get_text(input)
      end

      class <<self
        alias_method :text, :get_text
      end
    end
  end

  class ArticleExtractor
    def self.get_text(s)
      Extractors::ArticleExtractor.get_text s
    end

    class <<self
      alias_method :text, :get_text
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jruby-boilerpipe-0.3.0 lib/boilerpipe/extractors/article_extractor.rb
jruby-boilerpipe-0.2.0 lib/boilerpipe/extractors/article_extractor.rb