From 45aa21603cb9074e245be2d54b8e6ef5f1775c09 Mon Sep 17 00:00:00 2001 From: Kevin Kwok Date: Wed, 12 Oct 2016 03:54:20 -0400 Subject: [PATCH] updating --- dist/tesseract.js | 2 +- dist/worker.js | 16 ++++++++++------ src/browser/index.js | 3 +-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/dist/tesseract.js b/dist/tesseract.js index 377c4b2..f9ca70a 100644 --- a/dist/tesseract.js +++ b/dist/tesseract.js @@ -270,7 +270,7 @@ process.umask = function() { return 0; }; 'use strict'; var defaultOptions = { - workerPath: 'https://cdn.rawgit.com/naptha/tesseract.js/0.1.3/dist/worker.js', + workerPath: 'https://cdn.rawgit.com/naptha/tesseract.js/0.2.0/dist/worker.js', corePath: 'https://cdn.rawgit.com/naptha/tesseract.js-core/0.1.0/index.js', langPath: 'https://cdn.rawgit.com/naptha/tessdata/gh-pages/3.02/' }; diff --git a/dist/worker.js b/dist/worker.js index 136917c..a92f116 100644 --- a/dist/worker.js +++ b/dist/worker.js @@ -11943,9 +11943,9 @@ global.addEventListener('message', function (e) { exports.getCore = function (req, res) { if (!global.TesseractCore) { - res.progress({ status: 'loading tesseract core' }); + res.progress({ status: 'loading tesseract core', progress: 0 }); importScripts(req.workerOptions.corePath); - res.progress({ status: 'loaded tesseract core' }); + res.progress({ status: 'loading tesseract core', progress: 1 }); } return TesseractCore; }; @@ -12198,7 +12198,7 @@ function handleInit(req, res) { if (!Module) { var Core = adapter.getCore(req, res); - res.progress({ status: 'initializing tesseract api' }); + res.progress({ status: 'initializing tesseract', progress: 0 }); Module = Core({ TOTAL_MEMORY: req.memory, TesseractProgress: function TesseractProgress(percent) { @@ -12208,7 +12208,7 @@ function handleInit(req, res) { }); Module.FS_createPath("/", "tessdata", true, true); base = new Module.TessBaseAPI(); - res.progress({ status: 'initialized tesseract api' }); + res.progress({ status: 'initializing tesseract', progress: 1 }); } } @@ -12234,7 +12234,7 @@ function loadLanguage(req, res, cb) { adapter.getLanguageData(req, res, function (data) { Module.FS_createDataFile('tessdata', lang + ".traineddata", data, true, false); - res.progress({ status: 'loaded ' + lang + '.traineddata' }); + res.progress({ status: 'loading ' + lang + '.traineddata', progress: 1 }); Module._loadedLanguages[lang] = true; cb(); }); @@ -12246,8 +12246,9 @@ function handleRecognize(req, res) { loadLanguage(req, res, function () { var lang = req.options.lang; + res.progress({ status: 'initializing api', progress: 0 }); base.Init(null, lang); - res.progress({ status: 'initialized with language' }); + res.progress({ status: 'initializing api', progress: 0.3 }); var options = req.options; for (var option in options) { @@ -12256,7 +12257,10 @@ function handleRecognize(req, res) { } } + res.progress({ status: 'initializing api', progress: 0.6 }); var ptr = setImage(Module, base, req.image); + res.progress({ status: 'initializing api', progress: 1 }); + base.Recognize(null); var result = dump(Module, base); diff --git a/src/browser/index.js b/src/browser/index.js index d0172d8..1a6ac01 100644 --- a/src/browser/index.js +++ b/src/browser/index.js @@ -1,5 +1,5 @@ var defaultOptions = { - workerPath: 'https://cdn.rawgit.com/naptha/tesseract.js/0.1.3/dist/worker.js', + workerPath: 'https://cdn.rawgit.com/naptha/tesseract.js/0.2.0/dist/worker.js', corePath: 'https://cdn.rawgit.com/naptha/tesseract.js-core/0.1.0/index.js', langPath: 'https://cdn.rawgit.com/naptha/tessdata/gh-pages/3.02/', } @@ -9,7 +9,6 @@ if (process.env.NODE_ENV === "development") { defaultOptions.workerPath = location.protocol + '//' + location.host + '/dist/worker.dev.js' } - exports.defaultOptions = defaultOptions;