gnu: Add cl-ana.statistical-learning.
[jackhill/guix/guix.git] / gnu / packages / ocr.scm
CommitLineData
f99f6fd6
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
427dda54 3;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
ff8a66bc 4;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9a94ccec 5;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
f99f6fd6
LC
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
9e617a54 22(define-module (gnu packages ocr)
d814be32 23 #:use-module ((guix licenses) #:prefix license:)
f99f6fd6
LC
24 #:use-module (guix packages)
25 #:use-module (guix download)
9a94ccec 26 #:use-module (guix git-download)
f99f6fd6 27 #:use-module (guix build-system gnu)
16dd1fd0 28 #:use-module (guix build-system python)
d814be32 29 #:use-module (gnu packages compression)
16dd1fd0 30 #:use-module (gnu packages python)
427dda54 31 #:use-module (gnu packages image))
f99f6fd6
LC
32
33(define-public ocrad
34 (package
35 (name "ocrad")
ff8a66bc 36 (version "0.27")
f99f6fd6
LC
37 (source (origin
38 (method url-fetch)
39 (uri (string-append "mirror://gnu/ocrad/ocrad-"
40 version ".tar.lz"))
41 (sha256
42 (base32
ff8a66bc 43 "0divffvcaim89g4pvqs8kslbcxi475bcl3b4ynphf284k9zfdgx9"))))
f99f6fd6
LC
44 (build-system gnu-build-system)
45 (native-inputs `(("lzip" ,lzip)))
6fd52309 46 (home-page "https://www.gnu.org/software/ocrad/")
f99f6fd6
LC
47 (synopsis "Optical character recognition based on feature extraction")
48 (description
79c311b8
LC
49 "GNU Ocrad is an optical character recognition program based on a
50feature extraction method. It can read images in PBM, PGM or PPM formats and
51it produces text in 8-bit or UTF-8 formats.")
d814be32
TUBK
52 (license license:gpl3+)))
53
54(define-public tesseract-ocr
55 (package
56 (name "tesseract-ocr")
427dda54 57 (version "3.04.01")
d814be32
TUBK
58 (source
59 (origin
60 (method url-fetch)
61 (uri (string-append
427dda54 62 "https://github.com/tesseract-ocr/tesseract/archive/"
d814be32 63 version ".tar.gz"))
427dda54 64 (file-name (string-append name "-" version ".tar.gz"))
d814be32 65 (sha256
427dda54 66 (base32 "0snwd8as5i8vx7zkimpd2yg898jl96zf90r65a9w615f2hdkxxjp"))))
d814be32 67 (build-system gnu-build-system)
427dda54 68 (inputs
d814be32
TUBK
69 `(("leptonica" ,leptonica)))
70 (arguments
427dda54 71 '(#:configure-flags
d814be32
TUBK
72 (let ((leptonica (assoc-ref %build-inputs "leptonica")))
73 (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
427dda54 74 (home-page "https://github.com/tesseract-ocr")
d814be32
TUBK
75 (synopsis "Optical character recognition engine")
76 (description
77 "Tesseract is an optical character recognition (OCR) engine with very
78high accuracy. It supports many languages, output text formatting, hOCR
79positional information and page layout analysis. Several image formats are
80supported through the Leptonica library. It can also detect whether text is
81monospaced or proportional.")
82 (license license:asl2.0)))
9a94ccec
AV
83
84(define-public zinnia
85 (let* ((commit "581faa8f6f15e4a7b21964be3a5ec36265c80e5b")
86 (revision "1")
87 ;; version copied from 'configure.in'
88 (version (git-version "0.07" revision commit)))
89 (package
90 (name "zinnia")
91 (version version)
92 (source
93 (origin
94 (method git-fetch)
95 (uri (git-reference
96 (url "https://github.com/taku910/zinnia.git")
97 (commit commit)))
98 (sha256
99 (base32
100 "1izjy5qw6swg0rs2ym2i72zndb90mwrfbd1iv8xbpwckbm4899lg"))
101 (file-name (git-file-name name version))
102 (modules '((guix build utils)
103 (ice-9 ftw)
104 (srfi srfi-26)))
105 (snippet ; remove unnecessary files with potentially different license
106 '(begin
107 (for-each delete-file-recursively
108 (scandir "."
109 (negate (cut member <> '("zinnia"
110 "." "..")))))
111 #t))))
112 (build-system gnu-build-system)
113 (arguments
114 `(#:phases
115 (modify-phases %standard-phases
116 (replace 'bootstrap
117 (lambda _
118 (chdir "zinnia")
119 (for-each make-file-writable
120 '("config.log" "config.status"))
121 #t)))))
122 (home-page "https://taku910.github.io/zinnia/")
123 (synopsis "Online hand recognition system with machine learning")
124 (description
125 "Zinnia is a simple, customizable and portable online hand recognition
126system based on Support Vector Machines. Zinnia simply receives user pen
127strokes as a sequence of coordinate data and outputs n-best characters sorted
128by SVM confidence. To keep portability, Zinnia doesn't have any rendering
129functionality. In addition to recognition, Zinnia provides training module
130that allows us to create any hand-written recognition systems with low-cost.")
131 (license (list license:bsd-3 ; all files except...
132 (license:non-copyleft ; some autotools related files
133 "file://zinnia/aclocal.m4")
134 license:x11 ; 'install-sh'
135 license:public-domain))))) ; 'install-sh'
16dd1fd0
AV
136
137;;; python 2 bindings, license under the same terms as zinnia
138(define-public python2-zinnia
139 (package
140 (inherit zinnia)
141 (name "python2-zinnia")
142 (build-system python-build-system)
143 (arguments
144 `(#:python ,python-2 ; CObject API is used, it was removed in Python 3.2
145 #:tests? #f ; avoid circular dependency on tegaki-zinnia-japanese
146 #:phases
147 (modify-phases %standard-phases
148 (add-after 'unpack 'chdir
149 (lambda _
150 (chdir "zinnia/python")
151 #t)))))
152 (inputs
153 `(("zinnia" ,zinnia)))))