Browse Source

updating

pull/12/head 0.2.0
Kevin Kwok 8 years ago
parent
commit
45aa21603c
  1. 2
      dist/tesseract.js
  2. 16
      dist/worker.js
  3. 3
      src/browser/index.js

2
dist/tesseract.js vendored

@ -270,7 +270,7 @@ process.umask = function() { return 0; };
'use strict'; 'use strict';
var defaultOptions = { 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', 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/' langPath: 'https://cdn.rawgit.com/naptha/tessdata/gh-pages/3.02/'
}; };

16
dist/worker.js vendored

@ -11943,9 +11943,9 @@ global.addEventListener('message', function (e) {
exports.getCore = function (req, res) { exports.getCore = function (req, res) {
if (!global.TesseractCore) { if (!global.TesseractCore) {
res.progress({ status: 'loading tesseract core' }); res.progress({ status: 'loading tesseract core', progress: 0 });
importScripts(req.workerOptions.corePath); importScripts(req.workerOptions.corePath);
res.progress({ status: 'loaded tesseract core' }); res.progress({ status: 'loading tesseract core', progress: 1 });
} }
return TesseractCore; return TesseractCore;
}; };
@ -12198,7 +12198,7 @@ function handleInit(req, res) {
if (!Module) { if (!Module) {
var Core = adapter.getCore(req, res); var Core = adapter.getCore(req, res);
res.progress({ status: 'initializing tesseract api' }); res.progress({ status: 'initializing tesseract', progress: 0 });
Module = Core({ Module = Core({
TOTAL_MEMORY: req.memory, TOTAL_MEMORY: req.memory,
TesseractProgress: function TesseractProgress(percent) { TesseractProgress: function TesseractProgress(percent) {
@ -12208,7 +12208,7 @@ function handleInit(req, res) {
}); });
Module.FS_createPath("/", "tessdata", true, true); Module.FS_createPath("/", "tessdata", true, true);
base = new Module.TessBaseAPI(); 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) { adapter.getLanguageData(req, res, function (data) {
Module.FS_createDataFile('tessdata', lang + ".traineddata", data, true, false); 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; Module._loadedLanguages[lang] = true;
cb(); cb();
}); });
@ -12246,8 +12246,9 @@ function handleRecognize(req, res) {
loadLanguage(req, res, function () { loadLanguage(req, res, function () {
var lang = req.options.lang; var lang = req.options.lang;
res.progress({ status: 'initializing api', progress: 0 });
base.Init(null, lang); base.Init(null, lang);
res.progress({ status: 'initialized with language' }); res.progress({ status: 'initializing api', progress: 0.3 });
var options = req.options; var options = req.options;
for (var option in 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); var ptr = setImage(Module, base, req.image);
res.progress({ status: 'initializing api', progress: 1 });
base.Recognize(null); base.Recognize(null);
var result = dump(Module, base); var result = dump(Module, base);

3
src/browser/index.js

@ -1,5 +1,5 @@
var defaultOptions = { 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', 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/', 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' defaultOptions.workerPath = location.protocol + '//' + location.host + '/dist/worker.dev.js'
} }
exports.defaultOptions = defaultOptions; exports.defaultOptions = defaultOptions;

Loading…
Cancel
Save