This repository has been archived by the owner on Nov 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
292 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
bin/*.pdf | ||
|
||
*.sw* | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
pdf-extract (0.1.1) | ||
commander (>= 4.0.4) | ||
json (>= 1.5.1) | ||
nokogiri (>= 1.5.0) | ||
pdf-reader (= 1.3.3) | ||
prawn (>= 0.11.1) | ||
rb-libsvm (>= 1.1.3) | ||
sqlite3 (>= 1.3.4) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
Ascii85 (1.0.2) | ||
afm (0.2.0) | ||
bson (1.9.2) | ||
bson_ext (1.9.2) | ||
bson (~> 1.9.2) | ||
commander (4.1.5) | ||
highline (~> 1.6.11) | ||
hashery (2.1.1) | ||
highline (1.6.20) | ||
json (1.8.1) | ||
mini_portile (0.5.2) | ||
mongo (1.9.2) | ||
bson (~> 1.9.2) | ||
nokogiri (1.6.0) | ||
mini_portile (~> 0.5.0) | ||
pdf-reader (1.3.3) | ||
Ascii85 (~> 1.0.0) | ||
afm (~> 0.2.0) | ||
hashery (~> 2.0) | ||
ruby-rc4 | ||
ttfunk | ||
prawn (0.12.0) | ||
pdf-reader (>= 0.9.0) | ||
ttfunk (~> 1.0.2) | ||
rake (10.1.0) | ||
rb-libsvm (1.1.3) | ||
ruby-rc4 (0.1.5) | ||
sqlite3 (1.3.8) | ||
ttfunk (1.0.3) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
bson_ext (>= 1.9.2) | ||
mongo (>= 1.9.2) | ||
pdf-extract! | ||
rake (>= 10.1.0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require_relative 'tasks/assign.rb' | ||
require_relative 'tasks/train.rb' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1 @@ | ||
require_relative 'pdf' | ||
require_relative 'model/characters' | ||
require_relative 'model/chunks' | ||
require_relative 'model/regions' | ||
require_relative 'analysis/titles' | ||
require_relative 'analysis/margins' | ||
require_relative 'analysis/zones' | ||
require_relative 'analysis/columns' | ||
require_relative 'analysis/sections' | ||
require_relative 'references/references' | ||
require_relative 'references/resolved_references' | ||
require_relative 'view/pdf_view' | ||
require_relative 'view/xml_view' | ||
|
||
module PdfExtract | ||
|
||
@views = {} | ||
|
||
@parsers = [] | ||
|
||
def self.add_view name, view_class | ||
@views[name] = view_class | ||
end | ||
|
||
def self.add_parser parser_class | ||
@parsers << parser_class | ||
end | ||
|
||
def self.parse filename, &block | ||
pdf = Pdf.new | ||
|
||
@parsers.each do |p| | ||
p.include_in pdf | ||
end | ||
|
||
yield pdf | ||
|
||
pdf.spatial_calls.each do |spatial_call| | ||
name = spatial_call[:name] | ||
receiver = Receiver.new pdf | ||
pdf.spatial_builders[name].call receiver | ||
receiver.invoke_calls filename, pdf.spatial_options[name] | ||
end | ||
|
||
end | ||
|
||
def self.view_class short_name | ||
@views[short_name] | ||
end | ||
|
||
def self.view filename, options = {}, &block | ||
pdf = parse filename, &block | ||
view_class(options[:as]).new(pdf, filename).render options | ||
end | ||
|
||
def self.init | ||
add_parser Characters | ||
add_parser Chunks | ||
add_parser Regions | ||
add_parser Titles | ||
add_parser Margins | ||
add_parser Zones | ||
add_parser Columns | ||
add_parser Sections | ||
add_parser References | ||
add_parser ResolvedReferences | ||
|
||
add_view :pdf, PdfView | ||
add_view :xml, XmlView | ||
end | ||
|
||
init | ||
|
||
end | ||
require_relative 'pdf/extract.rb' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
require_relative 'extract/pdf.rb' | ||
require_relative 'extract/model/characters.rb' | ||
require_relative 'extract/model/chunks.rb' | ||
require_relative 'extract/model/regions.rb' | ||
require_relative 'extract/analysis/titles.rb' | ||
require_relative 'extract/analysis/margins.rb' | ||
require_relative 'extract/analysis/zones.rb' | ||
require_relative 'extract/analysis/columns.rb' | ||
require_relative 'extract/analysis/sections.rb' | ||
require_relative 'extract/references/references.rb' | ||
require_relative 'extract/references/resolved_references.rb' | ||
require_relative 'extract/view/pdf_view.rb' | ||
require_relative 'extract/view/xml_view.rb' | ||
|
||
module PdfExtract | ||
|
||
@views = {} | ||
|
||
@parsers = [] | ||
|
||
def self.add_view name, view_class | ||
@views[name] = view_class | ||
end | ||
|
||
def self.add_parser parser_class | ||
@parsers << parser_class | ||
end | ||
|
||
def self.parse filename, &block | ||
pdf = Pdf.new | ||
|
||
@parsers.each do |p| | ||
p.include_in pdf | ||
end | ||
|
||
yield pdf | ||
|
||
pdf.spatial_calls.each do |spatial_call| | ||
name = spatial_call[:name] | ||
receiver = Receiver.new pdf | ||
pdf.spatial_builders[name].call receiver | ||
receiver.invoke_calls filename, pdf.spatial_options[name] | ||
end | ||
|
||
end | ||
|
||
def self.view_class short_name | ||
@views[short_name] | ||
end | ||
|
||
def self.view filename, options = {}, &block | ||
pdf = parse filename, &block | ||
view_class(options[:as]).new(pdf, filename).render options | ||
end | ||
|
||
def self.init | ||
add_parser Characters | ||
add_parser Chunks | ||
add_parser Regions | ||
add_parser Titles | ||
add_parser Margins | ||
add_parser Zones | ||
add_parser Columns | ||
add_parser Sections | ||
add_parser References | ||
add_parser ResolvedReferences | ||
|
||
add_view :pdf, PdfView | ||
add_view :xml, XmlView | ||
end | ||
|
||
init | ||
|
||
end |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
require_relative "names" | ||
require_relative 'names.rb' | ||
|
||
module PdfExtract::Language | ||
|
||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.