jruby-boilerpipe 0.1.0 → 0.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 03a8f58cd513e79cfe0b2de46a694fc174311a51ab26bc283b1eb0b6095623a9
4
- data.tar.gz: 8ac91071568e525d647c92b01ddda2caabb6c5bec0e0e3201adb3c93eee3d77f
2
+ SHA1:
3
+ metadata.gz: 1a4b3ef0fc314be4616e53a70dcaa6cb689542f3
4
+ data.tar.gz: 94f1c2a283a255bf7c7e5aaa941807d4ceb9cf94
5
5
  SHA512:
6
- metadata.gz: fabda6c210c3d56c8785b4e1369e65682644cdda3b6670124128fe1333c08d65b67cbe72ab254060621d467692263b0ac2c195d761d1400d4e9ac7c7679b96dc
7
- data.tar.gz: 29acf923aea8178af93e0e195af72d133b6eae92cb9ce45b5e0e9454d0af9c27343c2096533275ca746fb2105d71e575e3f4c100a1323ed6aa2d5ac4842b1bf1
6
+ metadata.gz: 3720fab10515e2a6794bfe79042789cd4df4299192742498035001d5cb135555eb7b26576e6ce212b104ac23a5c4e975cbcc4dacd895a767bb98a6947d06add3
7
+ data.tar.gz: 9eebfc825da6725cdf8e253b5bbfe80097b1b7913f30f6465a0c2963e14a1a0444777f78887d538c60d9801b98efab6dfbaa4df6d5f5c4817f297b37977ad43d
data/README.md CHANGED
@@ -1,19 +1,13 @@
1
1
  # Boilerpipe
2
2
 
3
- I saw other gems wrapping boilerpipe but they seemed to be outdated, hit the free api or I couldn't get them to work because of dependency issues. I went directly to the original author's github https://github.com/kohlschutter/boilerpipe and forked that code base here https://github.com/gregors/boilerpipe . I made one notible change that is to add a user agent so article extractor wouldn't return a 403 for a variety of web servers. I compiled all dependencies into the jar using the maven-assembly-plugin using Java 8.
4
-
5
- Extractors added so far:
6
-
7
- * ArticleExtractor
8
- * DefaultExtractor
9
-
3
+ I saw other gems wrapping boilerpipe but they seemed to be outdated, hit the free api or I couldn't get them to work because of dependency issues. I went directly to the original author's github https://github.com/kohlschutter/boilerpipe and forked that code base here https://github.com/gregors/boilerpipe . I made one notible change that is to add a user agent so article extractor wouldn't return a 403 for a vareity of web servers. I compiled all dependencies into the jar using the maven-assembly-plugin using Java 8. Until the original author releases a proper 2.0 release I'll be appending rcx to reflect the latest snapshots.
10
4
 
11
5
  ## Installation
12
6
 
13
7
  Add this line to your application's Gemfile:
14
8
 
15
9
  ```ruby
16
- gem 'jruby-boilerpipe', require: 'boilerpipe'
10
+ gem 'boilerpipe'
17
11
  ```
18
12
 
19
13
  And then execute:
@@ -22,22 +16,16 @@ And then execute:
22
16
 
23
17
  Or install it yourself as:
24
18
 
25
- $ gem install jruby-boilerpipe
19
+ $ gem install boilerpipe
26
20
 
27
21
  ## Usage
28
- You can feed Boilerpipe:ArticleExractor either a valid url or html content.
29
-
30
- jruby-9.1.7.0 :001 > require 'boilerpipe'
31
- => true
32
- jruby-9.1.7.0 :003 > Boilerpipe::ArticleExtractor.text("https://github.com/jruby/jruby/wiki/AboutJRuby")
33
- => "Clone this wiki locally\nAbout JRuby\nJRuby is a 100% Java implementation of the Ruby programming language. It is Ruby for the JVM.\nJRuby provides a complete set of core \"builtin\" classes and syntax for the Ruby language, as well as most of the Ruby Standard Libraries. The standard libraries are mostly Ruby's own complement of .rb files, but a few that depend on C language-based extensions have been reimplemented. Some are still missing, but we hope to implement as many as is feasible.\nSee Differences Between MRI And JRuby for more information on potential incompatibilities between JRuby and the C implementation of Ruby.\nDevelopment Team\nJRuby's current core development team consists of nine developers:\nCharles Oliver Nutter (Red Hat) aka headius\nThomas Enebo (Red Hat) aka enebo\nNick Sieger (LivingSocial)\nThere are also many past contributors who still help out from time to time:\nOla Bini (Thoughtworks)\nMany more...check out the JRuby commit logs!\nLinks\n"
34
-
35
- jruby-9.1.7.0 :002 > require 'open-uri'
36
- => true
37
- jruby-9.1.7.0 :004 > contents = open("https://github.com/jruby/jruby/wiki/AboutJRuby").read
38
- jruby-9.1.7.0 :005 > Boilerpipe::ArticleExtractor.text(contents)
39
- => "Clone this wiki locally\nAbout JRuby\nJRuby is a 100% Java implementation of the Ruby programming language. It is Ruby for the JVM.\nJRuby provides a complete set of core \"builtin\" classes and syntax for the Ruby language, as well as most of the Ruby Standard Libraries. The standard libraries are mostly Ruby's own complement of .rb files, but a few that depend on C language-based extensions have been reimplemented. Some are still missing, but we hope to implement as many as is feasible.\nSee Differences Between MRI And JRuby for more information on potential incompatibilities between JRuby and the C implementation of Ruby.\nDevelopment Team\nJRuby's current core development team consists of nine developers:\nCharles Oliver Nutter (Red Hat) aka headius\nThomas Enebo (Red Hat) aka enebo\nNick Sieger (LivingSocial)\nThere are also many past contributors who still help out from time to time:\nOla Bini (Thoughtworks)\nMany more...check out the JRuby commit logs!\nLinks\n"
40
-
22
+
23
+ jruby-1.7.24 :001 > require 'boilerpipe'
24
+ => true
25
+ jruby-1.7.24 :002 > Boilerpipe::ArticleExtractor.text("https://github.com/jruby/jruby/wiki/AboutJRuby")
26
+ => "Clone this wiki locally\nAbout JRuby\nJRuby is a 100% Java implementation of the Ruby programming language. It is Ruby for the JVM.\nJRuby provides a complete set of core \"builtin\" classes and syntax for the Ruby language, as well as most of the Ruby Standard Libraries. The standard libraries are mostly Ruby's own complement of .rb files, but a few that depend on C language-based extensions have been reimplemented. Some are still missing, but we hope to implement as many as is feasible.\nSee Differences Between MRI And JRuby for more information on potential incompatibilities between JRuby and the C implementation of Ruby.\nDevelopment Team\nJRuby's current core development team consists of nine developers:\nCharles Oliver Nutter (Red Hat) aka headius\nThomas Enebo (Red Hat) aka enebo\nNick Sieger (LivingSocial)\n"
27
+
28
+
41
29
  ## Development
42
30
 
43
31
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -46,5 +34,5 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
46
34
 
47
35
  ## Contributing
48
36
 
49
- Bug reports and pull requests are welcome on GitHub at https://github.com/gregors/boilerpipe.
37
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/boilerpipe.
50
38
 
@@ -1,8 +1,18 @@
1
- require_relative 'boilerpipe-common-2.0-SNAPSHOT-jar-with-dependencies.jar'
2
1
  require 'boilerpipe/version'
3
- require 'boilerpipe/sax/boilerpipe_html_parser'
4
- require 'boilerpipe/document/document'
5
- require 'boilerpipe/extractors/article_extractor'
6
- require 'boilerpipe/extractors/default_extractor'
7
- require 'boilerpipe/filters/filters'
8
- require 'boilerpipe/labels/labels'
2
+ require_relative 'boilerpipe-common-2.0-SNAPSHOT-jar-with-dependencies.jar'
3
+
4
+ module Boilerpipe
5
+ java_import 'com.kohlschutter.boilerpipe.extractors.ArticleExtractor'
6
+ java_import java.net.URL
7
+
8
+ class ArticleExtractor
9
+ def self.get_text(s)
10
+ url = URL.new(s)
11
+ ArticleExtractor::INSTANCE.get_text(url)
12
+ end
13
+
14
+ class <<self
15
+ alias_method :text, :get_text
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Boilerpipe
2
- VERSION = '0.1.0'
2
+ VERSION = '0.2.0.rc1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby-boilerpipe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory Ostermayr
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-07 00:00:00.000000000 Z
11
+ date: 2016-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -69,12 +69,6 @@ files:
69
69
  - jruby-boilerpipe.gemspec
70
70
  - lib/boilerpipe-common-2.0-SNAPSHOT-jar-with-dependencies.jar
71
71
  - lib/boilerpipe.rb
72
- - lib/boilerpipe/document/document.rb
73
- - lib/boilerpipe/extractors/article_extractor.rb
74
- - lib/boilerpipe/extractors/default_extractor.rb
75
- - lib/boilerpipe/filters/filters.rb
76
- - lib/boilerpipe/labels/labels.rb
77
- - lib/boilerpipe/sax/boilerpipe_html_parser.rb
78
72
  - lib/boilerpipe/version.rb
79
73
  homepage: https://github.com/gregors/jruby-boilerpipe
80
74
  licenses: []
@@ -90,12 +84,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
84
  version: '0'
91
85
  required_rubygems_version: !ruby/object:Gem::Requirement
92
86
  requirements:
93
- - - ">="
87
+ - - ">"
94
88
  - !ruby/object:Gem::Version
95
- version: '0'
89
+ version: 1.3.1
96
90
  requirements: []
97
91
  rubyforge_project:
98
- rubygems_version: 2.6.11
92
+ rubygems_version: 2.4.8
99
93
  signing_key:
100
94
  specification_version: 4
101
95
  summary: Ruby wrapper around boilerpipe java library
@@ -1,16 +0,0 @@
1
- module Boilerpipe
2
- module Document
3
- java_import 'com.kohlschutter.boilerpipe.document.TextDocument'
4
- java_import 'com.kohlschutter.boilerpipe.document.TextBlock'
5
-
6
- class TextBlock
7
- # Adding a mapping from ruby symbols to the format string used on the java side
8
- # e.g. de.l3s.boilerpipe/INDICATES_END_OF_TEXT is not the same as INDICATES_END_OF_TEXT
9
- # This is only for when we do TextBlock#has_label? from jruby
10
- def has_label?(l)
11
- l = "de.l3s.boilerpipe/#{l.to_s}" if l.is_a?(Symbol)
12
- self.hasLabel(l)
13
- end
14
- end
15
- end
16
- end
@@ -1,22 +0,0 @@
1
- module Boilerpipe
2
- java_import 'com.kohlschutter.boilerpipe.extractors.ArticleExtractor'
3
- java_import java.net.URL
4
-
5
- class ArticleExtractor
6
- def self.get_text(s)
7
- url = nil
8
-
9
- begin
10
- url = Java::JavaNet::URL.new(s)
11
- rescue Java::JavaNet::MalformedURLException => e
12
- # not a URL
13
- end
14
- input = url ? url : s
15
- ArticleExtractor::INSTANCE.get_text(input)
16
- end
17
-
18
- class <<self
19
- alias_method :text, :get_text
20
- end
21
- end
22
- end
@@ -1,13 +0,0 @@
1
- module Boilerpipe
2
- java_import 'com.kohlschutter.boilerpipe.extractors.DefaultExtractor'
3
-
4
- class DefaultExtractor
5
- def self.get_text(s)
6
- DefaultExtractor::INSTANCE.get_text s
7
- end
8
-
9
- class <<self
10
- alias_method :text, :get_text
11
- end
12
- end
13
- end
@@ -1,53 +0,0 @@
1
- module Boilerpipe
2
- module Filters
3
- java_import 'com.kohlschutter.boilerpipe.filters.english.IgnoreBlocksAfterContentFilter'
4
- java_import 'com.kohlschutter.boilerpipe.filters.english.TerminatingBlocksFinder'
5
- java_import 'com.kohlschutter.boilerpipe.filters.english.NumWordsRulesClassifier'
6
- java_import 'com.kohlschutter.boilerpipe.filters.english.HeuristicFilterBase'
7
- java_import 'com.kohlschutter.boilerpipe.filters.heuristics.BlockProximityFusion'
8
- java_import 'com.kohlschutter.boilerpipe.filters.heuristics.DocumentTitleMatchClassifier'
9
- java_import 'com.kohlschutter.boilerpipe.filters.heuristics.ExpandTitleToContentFilter'
10
- java_import 'com.kohlschutter.boilerpipe.filters.heuristics.KeepLargestBlockFilter'
11
- java_import 'com.kohlschutter.boilerpipe.filters.heuristics.LargeBlockSameTagLevelToContentFilter'
12
- java_import 'com.kohlschutter.boilerpipe.filters.heuristics.ListAtEndFilter'
13
- java_import 'com.kohlschutter.boilerpipe.filters.heuristics.TrailingHeadlineToBoilerplateFilter'
14
- java_import 'com.kohlschutter.boilerpipe.filters.simple.BoilerplateBlockFilter'
15
-
16
- class ExpandTitleToContentFilter
17
- def self.process(doc)
18
- new.process(doc)
19
- end
20
- end
21
-
22
- class IgnoreBlocksAfterContentFilter
23
- def self.process(doc)
24
- DEFAULT_INSTANCE.process(doc)
25
- end
26
- end
27
-
28
- class LargeBlockSameTagLevelToContentFilter
29
- def self.process(doc)
30
- INSTANCE.process(doc)
31
- end
32
- end
33
-
34
- class TerminatingBlocksFinder
35
- def self.process(doc)
36
- new.process(doc)
37
- end
38
- end
39
-
40
- class TrailingHeadlineToBoilerplateFilter
41
- def self.process(doc)
42
- new.process(doc)
43
- end
44
- end
45
-
46
- class NumWordsRulesClassifier
47
- def self.process(doc)
48
- new.process(doc)
49
- end
50
- end
51
-
52
- end
53
- end
@@ -1,3 +0,0 @@
1
- module Boilerpipe::Labels
2
- java_import 'com.kohlschutter.boilerpipe.labels.DefaultLabels'
3
- end
@@ -1,17 +0,0 @@
1
- module Boilerpipe
2
- module SAX
3
- java_import 'com.kohlschutter.boilerpipe.sax.BoilerpipeHTMLParser'
4
- java_import 'org.xml.sax.InputSource'
5
- java_import java.io.StringReader
6
-
7
- class BoilerpipeHTMLParser
8
- def self.parse(text)
9
- parser = BoilerpipeHTMLParser.new
10
- string_reader = StringReader.new(text)
11
- is = InputSource.new(string_reader)
12
- parser.parse(is)
13
- parser.to_text_document
14
- end
15
- end
16
- end
17
- end