📖 readme docs updates
- ⚒📑 fix legend markdown list of links to anchors
- ⚒📛 fix badge to link to npm instead of badge
- 🆙📼 update outdated .error to .catch
- 🔗 link to gif
- 🎨 highlight files
- 👾📦 simplify and unify installation section, add yarn optionally for easier copy paste
Tesseract.js is a javascript library that gets words in [almost any language](./docs/tesseract_lang_list.md) out of images. ([Demo](http://tesseract.projectnaptha.com/))
Tesseract.js works with script tags, webpack/browserify, and node. [After you install it](#installation), using it is as simple as
Tesseract.js works with script tags, [webpack](https://webpack.js.org/)/[browserify](http://browserify.org/), and [node](nodejs.org). [After you install it](#installation), using it is as simple as
@ -30,17 +32,18 @@ You can simply include Tesseract.js with a cdn like this:
@@ -30,17 +32,18 @@ You can simply include Tesseract.js with a cdn like this:
Figures out what words are in `image`, where the words are in `image`, etc.
Figures out what words are in `image`, where the words are in `image`, etc.
> Note: `image` should be sufficiently high resolution.
> Often, the same image will get much better results if you upscale it before calling `recognize`.
@ -115,7 +117,7 @@ Figures out what script (e.g. 'Latin', 'Chinese') the words in image are writte
@@ -115,7 +117,7 @@ Figures out what script (e.g. 'Latin', 'Chinese') the words in image are writte
- `image` is any [ImageLike](#imagelike) object.
Returns a [TesseractJob](#tesseractjob) whose `then`, `progress`, `error` and `finally` methods can be used to act on the result of the script.
Returns a [TesseractJob](#tesseractjob) whose `then`, `progress`, `catch` and `finally` methods can be used to act on the result of the script.
```javascript
@ -150,9 +152,9 @@ In NodeJS, an image can be
@@ -150,9 +152,9 @@ In NodeJS, an image can be
## TesseractJob
A TesseractJob is an object returned by a call to `recognize` or `detect`. It's inspired by the ES6 Promise interface and provides `then` and `catch` methods. It also provides `finally` method, which will be fired regardless of the job fate. One important difference is that these methods return the job itself (to enable chaining) rather than new.
A TesseractJob is an object returned by a call to `recognize` or `detect`. It's inspired by the ES6 Promise interface and provides `then` and `catch` methods. It also provides `finally` method, which will be fired regardless of the job fate. One important difference is that these methods return the job itself (to enable chaining) rather than new.
Sets `callback` as the function that will be called regardless if the job fails or success.
@ -238,9 +240,9 @@ Sets `callback` as the function that will be called regardless if the job fails
@@ -238,9 +240,9 @@ Sets `callback` as the function that will be called regardless if the job fails
## Local Installation
In the browser, `tesseract.js` simply provides the API layer. Internally, it opens a WebWorker to handle requests. That worker itself loads code from the Emscripten-built `tesseract.js-core` which itself is hosted on a CDN. Then it dynamically loads language files hosted on another CDN.
In the browser, `tesseract.js` simply provides the API layer. Internally, it opens a WebWorker to handle requests. That worker itself loads code from the Emscripten-built `tesseract.js-core` which itself is hosted on a CDN. Then it dynamically loads language files hosted on another CDN.
Because of this we recommend loading `tesseract.js` from a CDN. But if you really need to have all your files local, you can use the `Tesseract.create` function which allows you to specify custom paths for workers, languages, and core.
Because of this we recommend loading `tesseract.js` from a CDN. But if you really need to have all your files local, you can use the `Tesseract.create` function which allows you to specify custom paths for workers, languages, and core.
```javascript
window.Tesseract = Tesseract.create({
@ -267,12 +269,12 @@ To run a development copy of tesseract.js, first clone this repo.
@@ -267,12 +269,12 @@ To run a development copy of tesseract.js, first clone this repo.
@ -281,10 +283,10 @@ Then, cd in to the folder, `npm install`, and `npm start`
@@ -281,10 +283,10 @@ Then, cd in to the folder, `npm install`, and `npm start`
```
Then open `http://localhost:7355/examples/file-input/demo.html` in your favorite browser. The devServer automatically rebuilds tesseract.js and tesseract.worker.js when you change files in the src folder.
Then open `http://localhost:7355/examples/file-input/demo.html` in your favorite browser. The devServer automatically rebuilds `tesseract.js` and `tesseract.worker.js` when you change files in the src folder.
### Building Static Files
After you've cloned the repo and run `npm install` as described in the [Development Section](#development), you can build static library files in the dist folder with
After you've cloned the repo and run `npm install` as described in the [Development Section](#development), you can build static library files in the dist folder with