@@ -138,7 +138,11 @@ function getPrzeklejText(file, callback) {
138
138
139
139
// });
140
140
newImage . getBuffer ( Jimp . MIME_JPEG , function ( err , data ) {
141
- Tesseract . recognize ( data ) . then ( function ( result ) {
141
+ Tesseract . recognize ( data , {
142
+ tessedit_pageseg_mode : 'PSM_SINGLE_CHAR' ,
143
+ tessedit_char_blacklist : '!?' ,
144
+ tessedit_char_whitelist : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
145
+ } ) . then ( function ( result ) {
142
146
var text = result [ "text" ] . replace ( / \W / g, '' ) ;
143
147
var confidence = result [ "confidence" ] ;
144
148
endConfidents += " Letter" + index + ": " + text + " => " + confidence + "%" ;
@@ -226,7 +230,10 @@ function getKeep2shareSText(file, callback) {
226
230
thinOut ( image , 2 , function ( image ) {
227
231
changeAllPresentPixelsToBlack ( image , function ( image ) {
228
232
image . getBuffer ( Jimp . MIME_JPEG , function ( err , data ) {
229
- Tesseract . recognize ( data ) . then ( function ( result ) {
233
+ Tesseract . recognize ( data , {
234
+ tessedit_char_blacklist : '0123456789!?' ,
235
+ tessedit_char_whitelist : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
236
+ } ) . then ( function ( result ) {
230
237
var text = result [ "text" ] . replace ( / \W / g, '' ) ;
231
238
var confidence = result [ "confidence" ] ;
232
239
callback ( { host : what2Scan , text : text , confidence : confidence } ) ;
0 commit comments