File: hocr_py.py

package info (click to toggle)
hocr 0.8.2-6
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 4,004 kB
  • ctags: 430
  • sloc: sh: 8,885; ansic: 7,481; makefile: 246; cpp: 242; python: 72; perl: 11; java: 1
file content (21 lines) | stat: -rw-r--r-- 426 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys

# use the hocr python module
from hocr import *

# get pnm picture file path from user
if len(sys.argv) > 1:
    
    # create a new Hocr object from pnm picture file
    hocr_engien = Hocr (sys.argv[1])
    
    # turn nikud off
    hocr_engien.set_opt_n (0)
    
    # print out text
    print hocr_engien.do_ocr ()
else:
    print "USAGE: hocr_py path_to_pnm_picture"