gnu: Add zinnia.
[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)
d814be32 28 #:use-module (gnu packages compression)
427dda54 29 #:use-module (gnu packages image))
f99f6fd6
LC
30
31(define-public ocrad
32 (package
33 (name "ocrad")
ff8a66bc 34 (version "0.27")
f99f6fd6
LC
35 (source (origin
36 (method url-fetch)
37 (uri (string-append "mirror://gnu/ocrad/ocrad-"
38 version ".tar.lz"))
39 (sha256
40 (base32
ff8a66bc 41 "0divffvcaim89g4pvqs8kslbcxi475bcl3b4ynphf284k9zfdgx9"))))
f99f6fd6
LC
42 (build-system gnu-build-system)
43 (native-inputs `(("lzip" ,lzip)))
6fd52309 44 (home-page "https://www.gnu.org/software/ocrad/")
f99f6fd6
LC
45 (synopsis "Optical character recognition based on feature extraction")
46 (description
79c311b8
LC
47 "GNU Ocrad is an optical character recognition program based on a
48feature extraction method. It can read images in PBM, PGM or PPM formats and
49it produces text in 8-bit or UTF-8 formats.")
d814be32
TUBK
50 (license license:gpl3+)))
51
52(define-public tesseract-ocr
53 (package
54 (name "tesseract-ocr")
427dda54 55 (version "3.04.01")
d814be32
TUBK
56 (source
57 (origin
58 (method url-fetch)
59 (uri (string-append
427dda54 60 "https://github.com/tesseract-ocr/tesseract/archive/"
d814be32 61 version ".tar.gz"))
427dda54 62 (file-name (string-append name "-" version ".tar.gz"))
d814be32 63 (sha256
427dda54 64 (base32 "0snwd8as5i8vx7zkimpd2yg898jl96zf90r65a9w615f2hdkxxjp"))))
d814be32 65 (build-system gnu-build-system)
427dda54 66 (inputs
d814be32
TUBK
67 `(("leptonica" ,leptonica)))
68 (arguments
427dda54 69 '(#:configure-flags
d814be32
TUBK
70 (let ((leptonica (assoc-ref %build-inputs "leptonica")))
71 (list (string-append "LIBLEPT_HEADERSDIR=" leptonica "/include")))))
427dda54 72 (home-page "https://github.com/tesseract-ocr")
d814be32
TUBK
73 (synopsis "Optical character recognition engine")
74 (description
75 "Tesseract is an optical character recognition (OCR) engine with very
76high accuracy. It supports many languages, output text formatting, hOCR
77positional information and page layout analysis. Several image formats are
78supported through the Leptonica library. It can also detect whether text is
79monospaced or proportional.")
80 (license license:asl2.0)))
9a94ccec
AV
81
82(define-public zinnia
83 (let* ((commit "581faa8f6f15e4a7b21964be3a5ec36265c80e5b")
84 (revision "1")
85 ;; version copied from 'configure.in'
86 (version (git-version "0.07" revision commit)))
87 (package
88 (name "zinnia")
89 (version version)
90 (source
91 (origin
92 (method git-fetch)
93 (uri (git-reference
94 (url "https://github.com/taku910/zinnia.git")
95 (commit commit)))
96 (sha256
97 (base32
98 "1izjy5qw6swg0rs2ym2i72zndb90mwrfbd1iv8xbpwckbm4899lg"))
99 (file-name (git-file-name name version))
100 (modules '((guix build utils)
101 (ice-9 ftw)
102 (srfi srfi-26)))
103 (snippet ; remove unnecessary files with potentially different license
104 '(begin
105 (for-each delete-file-recursively
106 (scandir "."
107 (negate (cut member <> '("zinnia"
108 "." "..")))))
109 #t))))
110 (build-system gnu-build-system)
111 (arguments
112 `(#:phases
113 (modify-phases %standard-phases
114 (replace 'bootstrap
115 (lambda _
116 (chdir "zinnia")
117 (for-each make-file-writable
118 '("config.log" "config.status"))
119 #t)))))
120 (home-page "https://taku910.github.io/zinnia/")
121 (synopsis "Online hand recognition system with machine learning")
122 (description
123 "Zinnia is a simple, customizable and portable online hand recognition
124system based on Support Vector Machines. Zinnia simply receives user pen
125strokes as a sequence of coordinate data and outputs n-best characters sorted
126by SVM confidence. To keep portability, Zinnia doesn't have any rendering
127functionality. In addition to recognition, Zinnia provides training module
128that allows us to create any hand-written recognition systems with low-cost.")
129 (license (list license:bsd-3 ; all files except...
130 (license:non-copyleft ; some autotools related files
131 "file://zinnia/aclocal.m4")
132 license:x11 ; 'install-sh'
133 license:public-domain))))) ; 'install-sh'