-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:louismullie/treat
Conflicts: Gemfile
- Loading branch information
Showing
7 changed files
with
25 additions
and
4 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 |
---|---|---|
|
@@ -4,6 +4,7 @@ gemspec | |
|
||
gem 'birch' | ||
gem 'schiphol' | ||
gem 'yomu' | ||
|
||
group :test do | ||
gem 'rspec' | ||
|
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,3 +1,5 @@ | ||
#encoding: UTF-8 | ||
|
||
{ | ||
dependencies: [ | ||
'punkt-segmenter', | ||
|
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 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,17 @@ | ||
require 'yomu' | ||
|
||
# This class is a wrapper for Yomu. | ||
# Yomu is a library for extracting text and metadata from files and documents | ||
# using the Apache Tika content analysis toolkit. | ||
class Treat::Workers::Formatters::Readers::Document | ||
# Extract the readable text from any document. | ||
# | ||
# Options: none. | ||
def self.read(document, options = {}) | ||
yomu = Yomu.new(document.file) | ||
|
||
document.value = yomu.text | ||
document.set :format, yomu.mimetype.extensions.first | ||
document | ||
end | ||
end |
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
Binary file not shown.
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