|
| 1 | +#compdef tesseract |
| 2 | + |
| 3 | +local psm=( |
| 4 | + '0\:Orientation\ and\ script\ detection\ \(OSD\)\ only' |
| 5 | + '1\:Automatic\ page\ segmentation\ with\ OSD' |
| 6 | + '2\:Automatic\ page\ segmentation,\ but\ no\ OSD,\ or\ OCR\ \(not\ implemented\)' |
| 7 | + '3\:Fully\ automatic\ page\ segmentation,\ but\ no\ OSD\ \(Default\)' |
| 8 | + '4\:Assume\ a\ single\ column\ of\ text\ of\ variable\ sizes' |
| 9 | + '5\:Assume\ a\ single\ uniform\ block\ of\ vertically\ aligned\ text' |
| 10 | + '6\:Assume\ a\ single\ uniform\ block\ of\ text' |
| 11 | + '7\:Treat\ the\ image\ as\ a\ single\ text\ line' |
| 12 | + '8\:Treat\ the\ image\ as\ a\ single\ word' |
| 13 | + '9\:Treat\ the\ image\ as\ a\ single\ word\ in\ a\ circle' |
| 14 | + '10\:Treat\ the\ image\ as\ a\ single\ character' |
| 15 | + '11\:Sparse\ text.\ Find\ as\ much\ text\ as\ possible\ in\ no\ particular\ order' |
| 16 | + '12\:Sparse\ text\ with\ OSD' |
| 17 | + '13\:Raw\ line.\ Treat\ the\ image\ as\ a\ single\ text\ line,\ bypassing\ hacks\ that\ are\ Tesseract-specific' |
| 18 | +) |
| 19 | +local oem=( |
| 20 | + '0\:Legacy\ engine\ only' |
| 21 | + '1\:Neural\ nets\ LSTM\ engine\ only' |
| 22 | + '2\:Legacy\ +\ LSTM\ engines' |
| 23 | + '3\:Default,\ based\ on\ what\ is\ available' |
| 24 | +) |
| 25 | +local options=( |
| 26 | + "(- : *)"{-h,--help}"[Show minimal help message]" |
| 27 | + "(- : *)"--help-extra"[Show extra help for advanced users]" |
| 28 | + "(- : *)"--help-psm"[Show page segmentation modes]" |
| 29 | + "(- : *)"--help-oem"[Show OCR Engine modes]" |
| 30 | + "(- : *)"{-v,--version}"[Show version information]" |
| 31 | + "(- : *)"--list-langs"[List available languages for tesseract engine]" |
| 32 | + "(- : *)"--print-fonts-table"[Print tesseract fonts table]" |
| 33 | + "(- : *)"--print-parameters"[Print tesseract parameters]" |
| 34 | + --tessdata-dir"[Specify the location of tessdata path]: :_dirs" |
| 35 | + --user-words"[Specify the location of user words file]: :_files" |
| 36 | + --user-patterns"[Specify the location of user patterns file]: :_files" |
| 37 | + --dpi"[Specify DPI for input image]:VALUE" |
| 38 | + --loglevel"[Specify logging level]:LEVEL:(ALL TRACE DEBUG INFO WARN ERROR FATAL OFF)" |
| 39 | + -l"[Specify language(s) used for OCR]:LANG:($(tesseract --list-langs | tail -n+2))" |
| 40 | + '*'-c"[Set value for config variables]:VAR=VALUE" |
| 41 | + --psm"[Specify page segmentation mode]:Page segmentation mode:(($psm))" |
| 42 | + --oem"[Specify OCR Engine mode]:OCR Engine mode:(($oem))" |
| 43 | +) |
| 44 | + |
| 45 | +_arguments -s -S $options ':imagename:_files' ':outputbase:_files' '*:config:_files' |
0 commit comments