sqed 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sqed/parser/ocr_parser.rb +6 -5
- data/lib/sqed/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16fabf13365a965d62bc8f33c490758cd36ef3d3ba14b0b4153b6f04a69d5d37
|
4
|
+
data.tar.gz: 6a88456e003e712c82aba444007dd9fc570a4c68dc2e8faf31ed0d88f6657b88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cb766fd49860d9c5578c37c5cb5244068e875f1e89ee566dc15e6809735f33b4082459f3b30a766ba2f538bc4c1e7768cbb78694633a1f7be592342c505c451
|
7
|
+
data.tar.gz: 12de2b92bedc0bad5605ab2b49334d0883ae3120e2d03905809f46f6b9d5fe38885b752486e6a4d694e9e197bf3d3c784f6c6278b7cf07b46346c34f96509a31
|
@@ -108,8 +108,9 @@ class Sqed::Parser::OcrParser < Sqed::Parser
|
|
108
108
|
|
109
109
|
# @return [String]
|
110
110
|
# the ocr text
|
111
|
+
# TODO: very kludge
|
111
112
|
def get_text(section_type: :default)
|
112
|
-
img = image
|
113
|
+
img = image.dup
|
113
114
|
|
114
115
|
# resample if an image 4"x4" is less than 300dpi
|
115
116
|
if img.columns * img.rows < 144000
|
@@ -120,7 +121,7 @@ class Sqed::Parser::OcrParser < Sqed::Parser
|
|
120
121
|
params.merge!(SECTION_PARAMS[section_type])
|
121
122
|
|
122
123
|
# May be able to overcome this hacky kludge messe with providing `processor:` to new
|
123
|
-
file = Tempfile.new('foo1')
|
124
|
+
file = Tempfile.new('foo1', encoding: 'ascii-8bit')
|
124
125
|
begin
|
125
126
|
file.write(image.to_blob)
|
126
127
|
file.rewind
|
@@ -140,20 +141,20 @@ class Sqed::Parser::OcrParser < Sqed::Parser
|
|
140
141
|
file.close
|
141
142
|
ensure
|
142
143
|
file.close
|
143
|
-
file.unlink
|
144
|
+
file.unlink
|
144
145
|
end
|
145
146
|
end
|
146
147
|
|
147
148
|
if @extracted_text == ''
|
148
149
|
file = Tempfile.new('foo3')
|
149
150
|
begin
|
150
|
-
file.write(img.dup.quantize(256,Magick::GRAYColorspace).to_blob)
|
151
|
+
file.write(img.dup.quantize(256, Magick::GRAYColorspace).to_blob)
|
151
152
|
file.rewind
|
152
153
|
@extracted_text = RTesseract.new(file.path, params).to_s&.strip
|
153
154
|
file.close
|
154
155
|
ensure
|
155
156
|
file.close
|
156
|
-
file.unlink
|
157
|
+
file.unlink
|
157
158
|
end
|
158
159
|
end
|
159
160
|
|
data/lib/sqed/version.rb
CHANGED