Browse Source

Merge pull request #118 from aretecode-forks/patch-1

📖 readme docs updates
pull/163/head
Kevin Kwok 7 years ago committed by GitHub
parent
commit
799eafab90
  1. 34
      README.md

34
README.md

@ -1,13 +1,15 @@
# [Tesseract.js](http://tesseract.projectnaptha.com/) # [Tesseract.js](http://tesseract.projectnaptha.com/)
[![npm version](https://badge.fury.io/js/tesseract.js.svg)](https://badge.fury.io/js/tesseract.js) [![NPM version][tesseractjs-npm-image]][tesseractjs-npm-url]
[tesseractjs-npm-image]: https://img.shields.io/npm/v/tesseract.js.svg
[tesseractjs-npm-url]: https://npmjs.org/package/tesseract.js
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 is a javascript library that gets words in [almost any language](./docs/tesseract_lang_list.md) out of images. ([Demo](http://tesseract.projectnaptha.com/))
[![fancy demo gif](./demo.gif "Demo")](http://tesseract.projectnaptha.com) [![fancy demo gif](https://github.com/naptha/tesseract.js/blob/master/demo.gif)](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
```javascript ```javascript
Tesseract.recognize(myImage) Tesseract.recognize(myImage)
.progress(function (p) { console.log('progress', p) }) .progress(function (p) { console.log('progress', p) })
@ -30,17 +32,18 @@ You can simply include Tesseract.js with a cdn like this:
<script src='https://cdn.rawgit.com/naptha/tesseract.js/1.0.10/dist/tesseract.js'></script> <script src='https://cdn.rawgit.com/naptha/tesseract.js/1.0.10/dist/tesseract.js'></script>
``` ```
After including your scripts, the `Tesseract` variable should be defined! You can [head to the docs](#docs) for a full treatment of the API. After including your scripts, the `Tesseract` variable will be defined globally!
## npm ## Dependency
First: First:
```shell ```shell
> yarn add tesseract
> npm install tesseract.js --save > npm install tesseract.js --save
``` ```
> Note: Tesseract.js currently requires node v6.8.0 or greater. > Note: Tesseract.js currently requires node v6.8.0 or greater.
Then ## Usage
```javascript ```javascript
var Tesseract = require('tesseract.js') var Tesseract = require('tesseract.js')
``` ```
@ -50,20 +53,19 @@ or
import Tesseract from 'tesseract.js' import Tesseract from 'tesseract.js'
``` ```
You can [head to the docs](#docs) for a full treatment of the API.
# Docs # Docs
* [Tesseract.recognize(image: ImageLike[, options]) -> [TesseractJob](#tesseractjob)](#tesseractrecognizeimage-imagelike-options---tesseractjob) * [Tesseract.recognize](#tesseractrecognizeimage-imagelike-options---tesseractjob)
+ [Simple Example](#simple-example) + [Simple Example](#simple-example)
+ [More Complicated Example](#more-complicated-example) + [More Complicated Example](#more-complicated-example)
* [Tesseract.detect(image: ImageLike) -> [TesseractJob](#tesseractjob)](#tesseractdetectimage-imagelike---tesseractjob) * [Tesseract.detect](#tesseractdetectimage-imagelike---tesseractjob) [TesseractJob](#tesseractjob)(#tesseractdetectimage-imagelike---tesseractjob)
* [ImageLike](#imagelike) * [ImageLike](#imagelike)
* [TesseractJob](#tesseractjob) * [TesseractJob](#tesseractjob)
+ [TesseractJob.progress(callback: function) -> TesseractJob](#tesseractjobprogresscallback-function---tesseractjob) + [TesseractJob.progress](#tesseractjobprogresscallback-function---tesseractjob)
+ [TesseractJob.then(callback: function) -> TesseractJob](#tesseractjobthencallback-function---tesseractjob) + [TesseractJob.then](#tesseractjobthencallback-function---tesseractjob)
+ [TesseractJob.catch(callback: function) -> TesseractJob](#tesseractjoberrorcallback-function---tesseractjob) + [TesseractJob.catch](#tesseractjobcatchcallback-function---tesseractjob)
+ [TesseractJob.finally(callback: function) -> TesseractJob](#tesseractjobfinallycallback-function---tesseractjob) + [TesseractJob.finally](#tesseractjobfinallycallback-function---tesseractjob)
* [Local Installation](#local-installation) * [Local Installation](#local-installation)
+ [corePath](#corepath) + [corePath](#corepath)
+ [workerPath](#workerpath) + [workerPath](#workerpath)
@ -115,7 +117,7 @@ Figures out what script (e.g. 'Latin', 'Chinese') the words in image are writte
- `image` is any [ImageLike](#imagelike) object. - `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 ```javascript
@ -267,7 +269,7 @@ To run a development copy of tesseract.js, first clone this repo.
> git clone https://github.com/naptha/tesseract.js.git > git clone https://github.com/naptha/tesseract.js.git
``` ```
Then, cd in to the folder, `npm install`, and `npm start` Then, `cd tesseract.js && npm install && npm start`
```shell ```shell
> cd tesseract.js > cd tesseract.js
> npm install && npm start > npm install && npm start
@ -281,7 +283,7 @@ 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 ### 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

Loading…
Cancel
Save