Browse Source

nodejs examples

pull/12/head
Kevin Kwok 8 years ago
parent
commit
7c66c3844c
  1. 1
      dist/README.md
  2. 6
      examples/node/basic.js
  3. BIN
      examples/node/cosmic.png
  4. 9
      examples/node/detect.js
  5. 23
      examples/node/test.js
  6. 2
      package.json

1
dist/README.md vendored

@ -1,4 +1,3 @@
# Using Tesseract.JS # Using Tesseract.JS
<script src='https://cdn.rawgit.com/naptha/tesseract.js/a01d2a2/dist/tesseract.js'></script> <script src='https://cdn.rawgit.com/naptha/tesseract.js/a01d2a2/dist/tesseract.js'></script>

6
examples/node/basic.js

@ -0,0 +1,6 @@
var Tesseract = require('../../') // replace this with require('tesseract.js')
Tesseract.recognize('cosmic.png')
.then(function(data){
console.log(data.text)
})

BIN
examples/node/cosmic.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

9
examples/node/detect.js

@ -0,0 +1,9 @@
var Tesseract = require('../../') // replace this with require('tesseract.js')
Tesseract.detect('cosmic.png')
.progress(function(info){
console.log(info)
})
.then(function(data){
console.log('done', data)
})

23
examples/node/test.js

@ -1,23 +0,0 @@
var Tesseract = require('./src/index.js')
global.Tesseract = Tesseract;
// Tesseract.recognize('yolop.png', {
// lang: 'eng'
// }).progress(function(info){
// console.log('--', info)
// })
// .then(function(data){
// console.log('--', data)
// })
// Tesseract.recognize('cosmic.jpg', {
// lang: 'eng'
// })
Tesseract.detect('cosmic.jpg')
.progress(function(info){
console.log(info)
})
.then(function(data){
console.log('done', data)
})

2
package.json

@ -2,7 +2,7 @@
"name": "tesseract.js", "name": "tesseract.js",
"version": "1.0.0", "version": "1.0.0",
"description": "Pure Javascript Multilingual OCR", "description": "Pure Javascript Multilingual OCR",
"main": "index.js", "main": "src/index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" & exit 1", "test": "echo \"Error: no test specified\" & exit 1",
"start": "watchify src/index.js -o dist/tesseract.js --standalone Tesseract & watchify src/browser/worker.js -o dist/worker.js & http-server -p 7355", "start": "watchify src/index.js -o dist/tesseract.js --standalone Tesseract & watchify src/browser/worker.js -o dist/worker.js & http-server -p 7355",

Loading…
Cancel
Save