Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromewu committed May 8, 2019
1 parent b488097 commit 9206c02
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { TesseractWorker } from 'tesseract.js';
const worker = new TesseractWorker();

worker.recognize(myImage)
.progress(function(p) { console.log('progress', p) })
.then(function()result) { console.log('result', result) })
.progress((p) => { console.log('progress', p); })
.then((result) => { console.log('result', result); });
```

[Check out the docs](#docs) for a full treatment of the API.
Expand All @@ -33,7 +33,7 @@ Tesseract.js wraps an [emscripten](https://github.com/kripken/emscripten) [port]
# Installation
Tesseract.js works with a `<script>` tag via local copy or CDN, with webpack via `npm`, and on Node.js via `npm`. [Check out the docs](#docs) for a full treatment of the API.

## &lt;script />
## CDN

You can simply include Tesseract.js with a CDN like this:
```html
Expand All @@ -42,7 +42,7 @@ You can simply include Tesseract.js with a CDN like this:

After including your scripts, the `Tesseract` variable will be defined globally!

## Dependency
## npm
First:
```shell
> yarn add tesseract.js
Expand All @@ -53,8 +53,9 @@ or
```
> Note: Tesseract.js currently requires Node.js v6.8.0 or higher.
# Docs
# Documentation

* [Examples](./docs/examples.md)
* [Tesseract.recognize](#tesseractrecognizeimage-imagelike-options---tesseractjob)
+ [Simple Example](#simple-example)
+ [More Complicated Example](#more-complicated-example)
Expand Down
55 changes: 55 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Tesseract.js Examples

### basic

```javascript
import Tesseract from 'tesseract.js';

const { TesseractWorker } = Tesseract;
const worker = new TessearctWorker();

worker
.recognize('http://jeroen.github.io/images/testocr.png')
.then((result) => {
console.log(result);
});
```

### with detailed progress

```javascript
import Tesseract from 'tesseract.js';

const { TesseractWorker } = Tesseract;
const worker = new TessearctWorker();

worker
.recognize('http://jeroen.github.io/images/testocr.png')
.progress((p) => {
console.log('progress', p);
})
.then((result) => {
console.log(result);
});
```

### with multiple languages (separate by '+'')

```javascript
import Tesseract from 'tesseract.js';

const { TesseractWorker } = Tesseract;
const worker = new TessearctWorker();

worker
.recognize(
'http://jeroen.github.io/images/testocr.png',
{ lang: 'eng+chi_tra' }
)
.progress((p) => {
console.log('progress', p);
})
.then((result) => {
console.log(result);
});
```

0 comments on commit 9206c02

Please sign in to comment.