Skip to content

Commit

Permalink
updating
Browse files Browse the repository at this point in the history
  • Loading branch information
antimatter15 committed Oct 12, 2016
1 parent 872284b commit 45aa216
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/tesseract.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
};
Expand Down
16 changes: 10 additions & 6 deletions dist/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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) {
Expand All @@ -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 });
}
}

Expand All @@ -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();
});
Expand All @@ -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) {
Expand All @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/browser/index.js
Original file line number Diff line number Diff line change
@@ -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/',
}
Expand All @@ -9,7 +9,6 @@ if (process.env.NODE_ENV === "development") {
defaultOptions.workerPath = location.protocol + '//' + location.host + '/dist/worker.dev.js'
}


exports.defaultOptions = defaultOptions;


Expand Down

0 comments on commit 45aa216

Please sign in to comment.