ocr_space 0.2.7.1 → 0.2.7.2
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/README.md +19 -16
- data/lib/ocr_space/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 418a4dd2032b0e6d684747e1310f26cf1ea4f0e2
|
4
|
+
data.tar.gz: 4230853e0240320fdf74bf45c6f45b8f066eb363
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8ae23c4f1756ad91dd345c44841c0c7a15047f6db299f2e30e7a15054a95679083572f6e041d87c0b927d801d2f77e0ec3fcbe8a5510f07a6782c86cb9b1c57
|
7
|
+
data.tar.gz: 6cf0b851adcee3ac73f7130e213815a258097728af9792bddb078a2b1dcdf419bfc1b67750a945a38a5146acd360f82bb6ec2af63e142074813b9977aca5b23b
|
data/README.md
CHANGED
@@ -28,18 +28,19 @@ Hosted at [rubygems.org](https://rubygems.org/gems/ocr_space)
|
|
28
28
|
|
29
29
|
#To convert images from url
|
30
30
|
|
31
|
+

|
32
|
+
|
31
33
|
```ruby
|
32
34
|
require 'ocr_space'
|
33
35
|
|
34
|
-
result = OcrSpace::FromUrl.new(apikey: "YOUR API KEY", url: "http://
|
35
|
-
|
36
|
-
puts result #Raw result
|
36
|
+
result = OcrSpace::FromUrl.new(apikey: "YOUR API KEY", url: "http://bit.ly/2ih9aXt")
|
37
37
|
|
38
|
-
|
38
|
+
p result
|
39
|
+
=> #<OcrSpace::FromUrl:0x007ff5ce404748 @data=#<HTTParty::Response:0x7ff5ce3efcf8 parsed_response={"ParsedResults"=>[{"TextOverlay"=>{"Lines"=>[], "HasOverlay"=>false, "Message"=>"Text overlay is not provided as it is not requested"}, "FileParseExitCode"=>1, "ParsedText"=>"If you want to find the secrets of the \r\nuniverse, think in terms of energy, \r\nfrequency and vibration. \r\nAZ QUOTES \r\n", "ErrorMessage"=>"", "ErrorDetails"=>""}], "OCRExitCode"=>1, "IsErroredOnProcessing"=>false, "ErrorMessage"=>nil, "ErrorDetails"=>nil, "ProcessingTimeInMilliseconds"=>"345"}, @response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"cache-control"=>["no-cache"], "pragma"=>["no-cache"], "content-length"=>["454"], "content-type"=>["application/json; charset=utf-8"], "expires"=>["-1"], "server"=>["Microsoft-IIS/10.0"], "x-aspnet-version"=>["4.0.30319"], "x-powered-by"=>["ASP.NET"], "date"=>["Sun, 25 Dec 2016 22:18:22 GMT"], "connection"=>["close"]}>>
|
39
40
|
|
40
|
-
|
41
|
+
p result.text_data #Clean result
|
41
42
|
|
42
|
-
=> "
|
43
|
+
=> "If you want to find the secrets of the \r\nuniverse, think in terms of energy, \r\nfrequency and vibration. \r\nAZ QUOTES \r\n"
|
43
44
|
```
|
44
45
|
|
45
46
|
#To convert images from file upload
|
@@ -47,25 +48,27 @@ puts result.text_data #Clean result
|
|
47
48
|
```ruby
|
48
49
|
require 'ocr_space'
|
49
50
|
|
50
|
-
result = OcrSpace::FromFile.new(apikey: "YOUR API KEY", files: "./
|
51
|
+
result = OcrSpace::FromFile.new(apikey: "YOUR API KEY", files: "./nicola_tesla.jpg")
|
51
52
|
|
52
|
-
|
53
|
+
p result #Raw result
|
53
54
|
|
54
|
-
=> #<OcrSpace::
|
55
|
+
=> #<OcrSpace::FromFile:0x007ff5ce3ae668 @file=#<File:./nicola_tesla.jpg>, @data=#<HTTParty::Response:0x7ff5ce2c41f8 parsed_response={"ParsedResults"=>[{"TextOverlay"=>{"Lines"=>[], "HasOverlay"=>false, "Message"=>"Text overlay is not provided as it is not requested"}, "FileParseExitCode"=>1, "ParsedText"=>"If you want to find the secrets of the \r\nuniverse, think in terms of energy, \r\nfrequency and vibration. \r\nAZ QUOTES \r\n", "ErrorMessage"=>"", "ErrorDetails"=>""}], "OCRExitCode"=>1, "IsErroredOnProcessing"=>false, "ErrorMessage"=>nil, "ErrorDetails"=>nil, "ProcessingTimeInMilliseconds"=>"311"}, @response=#<Net::HTTPOK 200 OK readbody=true>, @headers={"cache-control"=>["no-cache"], "pragma"=>["no-cache"], "content-length"=>["454"], "content-type"=>["application/json; charset=utf-8"], "expires"=>["-1"], "server"=>["Microsoft-IIS/10.0"], "x-aspnet-version"=>["4.0.30319"], "x-powered-by"=>["ASP.NET"], "date"=>["Sun, 25 Dec 2016 22:21:10 GMT"], "connection"=>["close"]}>>
|
55
56
|
|
56
|
-
|
57
|
+
p result.text_data #Clean result
|
58
|
+
|
59
|
+
=> "If you want to find the secrets of the \r\nuniverse, think in terms of energy, \r\nfrequency and vibration. \r\nAZ QUOTES \r\n"
|
57
60
|
|
58
|
-
=> "I am curious about \r\narea-filling text \r\nrendering options \r\n"
|
59
61
|
```
|
60
62
|
|
61
63
|
#COMMAND LINE INTERFACE ***BONUS***
|
62
64
|
|
63
|
-
You can run ocr_space through shell to get quick result from a image
|
65
|
+
You can run ocr_space through shell to get quick result from a image using filepath
|
64
66
|
|
65
67
|
```
|
66
|
-
$ ocrspace
|
68
|
+
$ ocrspace home/suyesh/nicola_tesla.jpg
|
69
|
+
|
70
|
+
$ "If you want to find the secrets of the \r\nuniverse, think in terms of energy, \r\nfrequency and vibration. \r\nAZ QUOTES \r\n"
|
67
71
|
|
68
|
-
$ "I am curious about \r\narea-filling text \r\nrendering options \r\n"
|
69
72
|
```
|
70
73
|
#NOTE
|
71
74
|
For commandline interface to work you will have to set ENV variable 'ocr_api_key' to your apikey.
|
@@ -76,9 +79,9 @@ $ export ocr_api_key='YOUR API KEY'
|
|
76
79
|
Also if you set env variable then you don't need to include apikey in your ruby scripts. You can just do the following -
|
77
80
|
|
78
81
|
```ruby
|
79
|
-
result = OcrSpace::FromFile.new(files: "./
|
82
|
+
result = OcrSpace::FromFile.new(files: "./nicola_tesla.jpg") #for File based
|
80
83
|
|
81
|
-
result = OcrSpace::FromUrl.new(url: "http://
|
84
|
+
result = OcrSpace::FromUrl.new(url: "http://bit.ly/2ih9aXt") #for URL based
|
82
85
|
|
83
86
|
```
|
84
87
|
|
data/lib/ocr_space/version.rb
CHANGED