gnu: deutex: Update to 5.2.1.
[jackhill/guix/guix.git] / gnu / packages / language.scm
CommitLineData
fc436dba 1;;; GNU Guix --- Functional package management for GNU
a2190ccc 2;;; Copyright © 2015, 2016 Eric Bavier <bavier@member.fsf.org>
9aba9b12 3;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
47956fa0 4;;; Copyright © 2018 ng0 <ng0@n0.is>
410387ad 5;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
fc436dba
EB
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
22(define-module (gnu packages language)
23 #:use-module (gnu packages)
410387ad 24 #:use-module (gnu packages glib)
58ac9289 25 #:use-module (gnu packages gtk)
c2810523 26 #:use-module (gnu packages ocr)
fc436dba 27 #:use-module (gnu packages perl)
410387ad
AV
28 #:use-module (gnu packages pkg-config)
29 #:use-module (gnu packages python)
5ccde207 30 #:use-module (gnu packages perl-check)
410387ad 31 #:use-module (gnu packages swig)
d7de0883 32 #:use-module (gnu packages web)
58ac9289 33 #:use-module (gnu packages xorg)
fc436dba 34 #:use-module (guix packages)
3ed30b88 35 #:use-module (guix build-system gnu)
fc436dba 36 #:use-module (guix build-system perl)
410387ad 37 #:use-module (guix build-system python)
c2810523 38 #:use-module ((guix licenses)
e4f72a58
AV
39 #:select
40 (bsd-3 gpl2 gpl2+ gpl3 gpl3+ lgpl2.1 perl-license zpl2.1))
c2810523 41 #:use-module (guix download)
e4f72a58 42 #:use-module (guix git-download)
c2810523 43 #:use-module (guix utils))
fc436dba 44
0c32bf01
EB
45(define-public perl-lingua-en-findnumber
46 (package
47 (name "perl-lingua-en-findnumber")
84f06e54 48 (version "1.32")
0c32bf01
EB
49 (source
50 (origin
51 (method url-fetch)
52 (uri (string-append "mirror://cpan/authors/id/N/NE/NEILB/"
53 "Lingua-EN-FindNumber-" version ".tar.gz"))
54 (sha256
55 (base32
84f06e54 56 "015ximzdp42v824llwlg2pd77vd0d172lb4xs55q9f9zhqf6s5qx"))))
0c32bf01
EB
57 (build-system perl-build-system)
58 (propagated-inputs
59 `(("perl-lingua-en-words2nums" ,perl-lingua-en-words2nums)))
9aba9b12 60 (home-page "https://metacpan.org/release/Lingua-EN-FindNumber")
0c32bf01
EB
61 (synopsis "Locate (written) numbers in English text ")
62 (description "This module provides a regular expression for finding
63numbers in English text. It also provides functions for extracting and
64manipulating such numbers.")
2f3108ad 65 (license perl-license)))
0c32bf01 66
57ff0e04
EB
67(define-public perl-lingua-en-inflect
68 (package
69 (name "perl-lingua-en-inflect")
ce0be1bc 70 (version "1.903")
57ff0e04
EB
71 (source
72 (origin
73 (method url-fetch)
74 (uri (string-append "mirror://cpan/authors/id/D/DC/DCONWAY/"
75 "Lingua-EN-Inflect-" version ".tar.gz"))
76 (sha256
77 (base32
ce0be1bc 78 "0j8d1f1wvmgc11d71pc8xp8fv5a1nb2yfw1dgd19xhscn1klpvzw"))))
57ff0e04 79 (build-system perl-build-system)
a2190ccc 80 (native-inputs `(("perl-module-build" ,perl-module-build)))
9aba9b12 81 (home-page "https://metacpan.org/release/Lingua-EN-Inflect")
57ff0e04
EB
82 (synopsis "Convert singular to plural")
83 (description "Lingua::EN::Inflect provides plural inflections,
84\"a\"/\"an\" selection for English words, and manipulation of numbers as
85words. Plural forms of all nouns, most verbs, and some adjectives are
86provided. Where appropriate, \"classical\" variants (for example: \"brother\"
87-> \"brethren\", \"dogma\" -> \"dogmata\", etc.) are also provided.")
2f3108ad 88 (license perl-license)))
57ff0e04 89
4812a813
EB
90(define-public perl-lingua-en-inflect-number
91 (package
92 (name "perl-lingua-en-inflect-number")
e2fb341f 93 (version "1.12")
4812a813
EB
94 (source
95 (origin
96 (method url-fetch)
97 (uri (string-append "mirror://cpan/authors/id/N/NE/NEILB/"
98 "Lingua-EN-Inflect-Number-" version ".tar.gz"))
99 (sha256
100 (base32
e2fb341f 101 "1gxccynkaqav43ww43jp4rzkyr36x97jd03yb5f6yx0jhn1k7yv6"))))
4812a813
EB
102 (build-system perl-build-system)
103 (propagated-inputs
104 `(("perl-lingua-en-inflect" ,perl-lingua-en-inflect)))
9aba9b12 105 (home-page "https://metacpan.org/release/Lingua-EN-Inflect-Number")
4812a813
EB
106 (synopsis "Force number of words to singular or plural")
107 (description "This module extends the functionality of Lingua::EN::Inflect
108with three new functions for determining plurality of a word and forcefully
109converting a word to singular or plural.")
2f3108ad 110 (license perl-license)))
4812a813 111
cfed969c
EB
112(define-public perl-lingua-en-inflect-phrase
113 (package
114 (name "perl-lingua-en-inflect-phrase")
cd75b642 115 (version "0.20")
cfed969c
EB
116 (source
117 (origin
118 (method url-fetch)
119 (uri (string-append "mirror://cpan/authors/id/R/RK/RKITOVER/"
120 "Lingua-EN-Inflect-Phrase-" version ".tar.gz"))
121 (sha256
122 (base32
cd75b642 123 "1a6y1l2pjim2242wcpgz066di4pbzfgsjjdl7vg5a5wzm48qj1am"))))
cfed969c
EB
124 (build-system perl-build-system)
125 (native-inputs
126 `(("perl-test-nowarnings" ,perl-test-nowarnings)))
127 (propagated-inputs
128 `(("perl-lingua-en-findnumber" ,perl-lingua-en-findnumber)
129 ("perl-lingua-en-inflect" ,perl-lingua-en-inflect)
130 ("perl-lingua-en-inflect-number" ,perl-lingua-en-inflect-number)
131 ("perl-lingua-en-number-isordinal" ,perl-lingua-en-number-isordinal)
132 ("perl-lingua-en-tagger" ,perl-lingua-en-tagger)))
9aba9b12 133 (home-page "https://metacpan.org/release/Lingua-EN-Inflect-Phrase")
cfed969c
EB
134 (synopsis "Inflect short English phrases")
135 (description "This module attempts to pluralize or singularize short
136English phrases.")
2f3108ad 137 (license perl-license)))
cfed969c 138
930768b3
EB
139(define-public perl-lingua-en-number-isordinal
140 (package
141 (name "perl-lingua-en-number-isordinal")
5b5b4edf 142 (version "0.05")
930768b3
EB
143 (source
144 (origin
145 (method url-fetch)
146 (uri (string-append "mirror://cpan/authors/id/R/RK/RKITOVER/"
147 "Lingua-EN-Number-IsOrdinal-" version ".tar.gz"))
148 (sha256
149 (base32
5b5b4edf 150 "1mhqjvh2ad30gjab5b3a6mbr4aysyrscp4wp42yy5x6001a6km98"))))
930768b3
EB
151 (build-system perl-build-system)
152 (native-inputs
153 `(("perl-try-tiny" ,perl-try-tiny)
154 ("perl-test-fatal" ,perl-test-fatal)))
155 (propagated-inputs
156 `(("perl-lingua-en-findnumber" ,perl-lingua-en-findnumber)))
9aba9b12 157 (home-page "https://metacpan.org/release/Lingua-EN-Number-IsOrdinal")
930768b3
EB
158 (synopsis "Detect if English number is ordinal or cardinal")
159 (description "This module will tell you if a number, either in words or as
160digits, is a cardinal or ordinal number.")
2f3108ad 161 (license perl-license)))
930768b3 162
d7de0883
EB
163(define-public perl-lingua-en-tagger
164 (package
165 (name "perl-lingua-en-tagger")
35e4e359 166 (version "0.30")
d7de0883
EB
167 (source
168 (origin
169 (method url-fetch)
170 (uri (string-append "mirror://cpan/authors/id/A/AC/ACOBURN/"
171 "Lingua-EN-Tagger-" version ".tar.gz"))
172 (sha256
173 (base32
35e4e359 174 "0nrnkvsf9f0a7lp82sanmy89ms2nqq1lvjqicvsagsvzp513bl5b"))))
d7de0883
EB
175 (build-system perl-build-system)
176 (propagated-inputs
177 `(("perl-memoize-expirelru" ,perl-memoize-expirelru)
178 ("perl-lingua-stem" ,perl-lingua-stem)
179 ("perl-html-parser" ,perl-html-parser)
180 ("perl-html-tagset" ,perl-html-tagset)))
9aba9b12 181 (home-page "https://metacpan.org/release/Lingua-EN-Tagger")
d7de0883
EB
182 (synopsis "Part-of-speech tagger for English natural language processing")
183 (description "This module is a probability based, corpus-trained tagger
184that assigns part-of-speech tags to English text based on a lookup dictionary
185and a set of probability values. The tagger assigns appropriate tags based on
186conditional probabilities - it examines the preceding tag to determine the
187appropriate tag for the current word. Unknown words are classified according
188to word morphology or can be set to be treated as nouns or other parts of
189speech. The tagger also extracts as many nouns and noun phrases as it can,
190using a set of regular expressions.")
191 (license gpl3)))
192
fc436dba
EB
193(define-public perl-lingua-en-words2nums
194 (package
195 (name "perl-lingua-en-words2nums")
196 (version "0.18")
197 (source
198 (origin
199 (method url-fetch)
200 (uri (string-append "mirror://cpan/authors/id/J/JO/JOEY/"
201 "Lingua-EN-Words2Nums-" version ".tar.gz"))
202 (sha256
203 (base32
204 "118xx8qr1zbx30psv7ic55w65h15mc1vz6zicshfm96jgiwmcrb8"))))
205 (build-system perl-build-system)
9aba9b12 206 (home-page "https://metacpan.org/release/Lingua-EN-Words2Nums")
fc436dba
EB
207 (synopsis "Convert English text to numbers")
208 (description "This module converts English text into numbers. It supports
209both ordinal and cardinal numbers, negative numbers, and very large numbers.")
2f3108ad 210 (license perl-license)))
9b446711
EB
211
212(define-public perl-lingua-pt-stemmer
213 (package
214 (name "perl-lingua-pt-stemmer")
8895a968 215 (version "0.02")
9b446711
EB
216 (source
217 (origin
218 (method url-fetch)
e8409dd2 219 (uri (string-append "mirror://cpan/authors/id/N/NE/NEILB/"
9b446711
EB
220 "Lingua-PT-Stemmer-" version ".tar.gz"))
221 (sha256
222 (base32
8895a968 223 "17c48sfbgwd2ivlgf59sr6jdhwa3aim8750f8pyzz7xpi8gz0var"))))
9b446711 224 (build-system perl-build-system)
9aba9b12 225 (home-page "https://metacpan.org/release/Lingua-PT-Stemmer")
9b446711
EB
226 (synopsis "Portuguese language stemming")
227 (description "This module implements a Portuguese stemming algorithm
228proposed in the paper A Stemming Algorithm for the Portuguese Language by
229Moreira, V. and Huyck, C.")
2f3108ad 230 (license perl-license)))
df11e052 231
9766e4fe
EB
232(define-public perl-lingua-stem
233 (package
234 (name "perl-lingua-stem")
235 (version "0.84")
236 (source
237 (origin
238 (method url-fetch)
239 (uri (string-append "mirror://cpan/authors/id/S/SN/SNOWHARE/"
240 "Lingua-Stem-" version ".tar.gz"))
241 (sha256
242 (base32
243 "12avh2mnnc7llmmshrr5bgb473fvydxnlqrqbl2815mf2dp4pxcg"))))
244 (build-system perl-build-system)
a2190ccc
EB
245 (native-inputs
246 `(("perl-module-build" ,perl-module-build)))
9766e4fe
EB
247 (propagated-inputs
248 `(("perl-lingua-pt-stemmer" ,perl-lingua-pt-stemmer)
249 ("perl-lingua-stem-fr" ,perl-lingua-stem-fr)
250 ("perl-lingua-stem-it" ,perl-lingua-stem-it)
251 ("perl-lingua-stem-ru" ,perl-lingua-stem-ru)
252 ("perl-lingua-stem-snowball-da" ,perl-lingua-stem-snowball-da)
253 ("perl-snowball-norwegian" ,perl-snowball-norwegian)
254 ("perl-snowball-swedish" ,perl-snowball-swedish)
255 ("perl-text-german" ,perl-text-german)))
9aba9b12 256 (home-page "https://metacpan.org/release/Lingua-Stem")
9766e4fe
EB
257 (synopsis "Stemming of words in various languages")
258 (description "This routine applies stemming algorithms to its parameters,
259returning the stemmed words as appropriate to the selected locale.")
2f3108ad 260 (license perl-license)))
9766e4fe 261
df11e052
EB
262(define-public perl-lingua-stem-fr
263 (package
264 (name "perl-lingua-stem-fr")
265 (version "0.02")
266 (source
267 (origin
268 (method url-fetch)
269 (uri (string-append "mirror://cpan/authors/id/S/SD/SDP/"
270 "Lingua-Stem-Fr-" version ".tar.gz"))
271 (sha256
272 (base32
273 "0vyrspwzaqjxm5mqshf4wvwa3938mkajd1918d9ii2l9m2rn8kwx"))))
274 (build-system perl-build-system)
9aba9b12 275 (home-page "https://metacpan.org/release/Lingua-Stem-Fr")
df11e052
EB
276 (synopsis "Porter's stemming algorithm for French")
277 (description "This module uses a modified version of the Porter Stemming
278Algorithm to return a stemmed French word.")
2f3108ad 279 (license perl-license)))
6afe5959
EB
280
281(define-public perl-lingua-stem-it
282 (package
283 (name "perl-lingua-stem-it")
284 (version "0.02")
285 (source
286 (origin
287 (method url-fetch)
288 (uri (string-append "mirror://cpan/authors/id/A/AC/ACALPINI/"
289 "Lingua-Stem-It-" version ".tar.gz"))
290 (sha256
291 (base32
292 "1207r183s5hlh4mfwa6p46vzm0dhvrs2dnss5s41a0gyfkxp7riq"))))
293 (build-system perl-build-system)
9aba9b12 294 (home-page "https://metacpan.org/release/Lingua-Stem-It")
6afe5959
EB
295 (synopsis "Porter's stemming algorithm for Italian")
296 (description "This module applies the Porter Stemming Algorithm to its
297parameters, returning the stemmed Italian word.")
2f3108ad 298 (license perl-license)))
95d2eec1
EB
299
300(define-public perl-lingua-stem-ru
301 (package
302 (name "perl-lingua-stem-ru")
a4b7142e 303 (version "0.04")
95d2eec1
EB
304 (source
305 (origin
306 (method url-fetch)
a4b7142e 307 (uri (string-append "mirror://cpan/authors/id/N/NE/NEILB/"
95d2eec1
EB
308 "Lingua-Stem-Ru-" version ".tar.gz"))
309 (sha256
310 (base32
a4b7142e 311 "0a2jmdz7jn32qj5hyiw5kbv8fvlpmws8i00a6xcbkzb48yvwww0j"))))
95d2eec1 312 (build-system perl-build-system)
9aba9b12 313 (home-page "https://metacpan.org/release/Lingua-Stem-Ru")
95d2eec1
EB
314 (synopsis "Porter's stemming algorithm for Russian")
315 (description "This module applies the Porter Stemming Algorithm to its
316parameters, returning the stemmed Russian (KOI8-R only) word.")
2f3108ad 317 (license perl-license)))
30c40044
EB
318
319(define-public perl-lingua-stem-snowball-da
320 (package
321 (name "perl-lingua-stem-snowball-da")
322 (version "1.01")
323 (source
324 (origin
325 (method url-fetch)
326 (uri (string-append "mirror://cpan/authors/id/C/CI/CINE/"
327 "Lingua-Stem-Snowball-Da-" version ".tar.gz"))
328 (sha256
329 (base32
330 "0mm0m7glm1s6i9f6a78jslw6wh573208arxhq93yriqmw17bwf9f"))))
331 (build-system perl-build-system)
9aba9b12 332 (home-page "https://metacpan.org/release/Lingua-Stem-Snowball-Da")
30c40044
EB
333 (synopsis "Porters stemming algorithm for Danish")
334 (description "Lingua::Stem::Snowball::Da is a perl port of the danish
335stemmer at http://snowball.sourceforge.net, it was originally altered from the
336Lingua::Stem::Snowball::Se.")
337 (license gpl2)))
1064abdc
EB
338
339(define-public perl-snowball-norwegian
340 (package
341 (name "perl-snowball-norwegian")
342 (version "1.2")
343 (source
344 (origin
345 (method url-fetch)
346 (uri (string-append "mirror://cpan/authors/id/A/AS/ASKSH/"
347 "Snowball-Norwegian-" version ".tar.gz"))
348 (sha256
349 (base32
350 "0675v45bbsh7vr7kpf36xs2q79g02iq1kmfw22h20xdk4rzqvkqx"))))
351 (build-system perl-build-system)
a2190ccc 352 (native-inputs `(("perl-module-build" ,perl-module-build)))
9aba9b12 353 (home-page "https://metacpan.org/release/Snowball-Norwegian")
1064abdc
EB
354 (synopsis "Porters stemming algorithm for Norwegian")
355 (description "Lingua::Stem::Snowball::No is a perl port of the norwegian
356stemmer at http://snowball.tartarus.org.")
2f3108ad 357 (license perl-license)))
1f4b1129
EB
358
359(define-public perl-snowball-swedish
360 (package
361 (name "perl-snowball-swedish")
362 (version "1.2")
363 (source
364 (origin
365 (method url-fetch)
366 (uri (string-append "mirror://cpan/authors/id/A/AS/ASKSH/"
367 "Snowball-Swedish-" version ".tar.gz"))
368 (sha256
369 (base32
370 "0agwc12jk5kmabnpsplw3wf4ii5w1zb159cpin44x3srb0sr5apg"))))
371 (build-system perl-build-system)
a2190ccc 372 (native-inputs `(("perl-module-build" ,perl-module-build)))
9aba9b12 373 (home-page "https://metacpan.org/release/Snowball-Swedish")
1f4b1129
EB
374 (synopsis "Porters stemming algorithm for Swedish")
375 (description "Lingua::Stem::Snowball::Se is a perl port of the swedish
376stemmer at http://snowball.sourceforge.net.")
2f3108ad 377 (license perl-license)))
2b83abae 378
f3bbbb73
EB
379(define-public perl-string-toidentifier-en
380 (package
381 (name "perl-string-toidentifier-en")
97c79494 382 (version "0.12")
f3bbbb73
EB
383 (source
384 (origin
385 (method url-fetch)
386 (uri (string-append "mirror://cpan/authors/id/R/RK/RKITOVER/"
387 "String-ToIdentifier-EN-" version ".tar.gz"))
388 (sha256
389 (base32
97c79494 390 "12nw7h2yiybhdw0vnnpc7bif8ylhsn6kqf6s39dsrf9h54iq9yrs"))))
f3bbbb73
EB
391 (build-system perl-build-system)
392 (propagated-inputs
393 `(("perl-lingua-en-inflect-phrase" ,perl-lingua-en-inflect-phrase)
394 ("perl-text-unidecode" ,perl-text-unidecode)
395 ("perl-namespace-clean" ,perl-namespace-clean)))
9aba9b12 396 (home-page "https://metacpan.org/release/String-ToIdentifier-EN")
e881752c 397 (synopsis "Convert strings to English program identifiers")
f3bbbb73
EB
398 (description "This module provides a utility method, \"to_identifier\" for
399converting an arbitrary string into a readable representation using the ASCII
400subset of \"\\w\" for use as an identifier in a computer program. The intent
401is to make unique identifier names from which the content of the original
402string can be easily inferred by a human just by reading the identifier.")
2f3108ad 403 (license perl-license)))
f3bbbb73 404
2b83abae
EB
405(define-public perl-text-german
406 (package
407 (name "perl-text-german")
408 (version "0.06")
409 (source
410 (origin
411 (method url-fetch)
412 (uri (string-append "mirror://cpan/authors/id/U/UL/ULPFR/"
413 "Text-German-" version ".tar.gz"))
414 (sha256
415 (base32
416 "1p87pgap99lw0nv62i3ghvsi7yg90lhn8vsa3yqp75rd04clybcj"))))
417 (build-system perl-build-system)
9aba9b12 418 (home-page "https://metacpan.org/release/Text-German")
2b83abae 419 (synopsis "German grundform reduction")
e881752c 420 (description "This module is a rather incomplete implementation of work
2b83abae 421done by Gudrun Putze-Meier.")
2f3108ad 422 (license perl-license)))
410387ad
AV
423
424(define* (tegaki-release-uri proj version
425 #:optional (ext "tar.gz"))
426 (string-append "https://github.com/tegaki/tegaki/releases/download"
427 "/v" version "/" proj "-" version "." ext))
428
429(define remove-pre-compiled-files
430 (lambda exts
431 "Return snippet for removing pre-compiled files matching one of the
432extensions in EXTS."
433 `(begin (for-each delete-file
434 (find-files "."
435 (lambda (name _)
436 (any (cut string-suffix? <> name)
437 (map (cut string-append "." <>)
438 ',exts)))))
439 #t)))
440
441;;; modules required for the above snippet
442(define remove-pre-compiled-files-modules
443 '((guix build utils)
444 (srfi srfi-1)
445 (srfi srfi-26)))
446
447(define-public python2-tegaki-wagomu
448 (package
449 (name "python2-tegaki-wagomu")
450 (version "0.3.1")
451 (source
452 (origin
453 (method url-fetch)
454 (uri (tegaki-release-uri "tegaki-wagomu" version))
455 (sha256
456 (base32
457 "1pzdiq4zy1nyylaj9i6v2h4h0r05klahskzpafpp367p4rysi1x9"))
458 (modules remove-pre-compiled-files-modules)
459 (snippet (remove-pre-compiled-files "pyc"))))
460 (build-system python-build-system)
461 (arguments
462 `(#:python ,python-2 ; only Python 2 is supported
463 #:phases
464 (modify-phases %standard-phases
465 (add-after 'unpack 'fix-recognizer
466 (lambda* (#:key inputs #:allow-other-keys)
467 ;; fix missing module and function
468 (substitute* "tegakiwagomu.py"
469 (("import Results,")
470 "import ")
471 (("def _recognize")
472 "def recognize")
473 (("Results\\(candidates\\)")
474 "candidates"))
475 #t)))))
476 (inputs
477 `(("glib" ,glib)))
478 (native-inputs
479 `(("pkg-config" ,pkg-config)
480 ("swig" ,swig)))
481 (home-page "https://tegaki.github.io/")
482 (synopsis
483 "Chinese and Japanese Handwriting Recognition (Recognition engine)")
484 (description
485 "Tegaki is an ongoing project which aims to develop a free and open-source
486modern implementation of handwriting recognition software, specifically
487designed for Chinese (simplified and traditional) and Japanese, and that is
488suitable for both the desktop and mobile devices.")
489 (license gpl2+))) ; all files
c2810523
AV
490
491(define-public python2-tegaki-python
492 (package
493 (inherit python2-tegaki-wagomu)
494 (name "python2-tegaki-python")
495 (version "0.3.1")
496 (source
497 (origin
498 (method url-fetch)
499 (uri (tegaki-release-uri "tegaki-python" version))
500 (sha256
501 (base32
502 "0x93k7pw9nh0ywd97pr8pm7jv3f94nw044i5k0zvzhdpsjqvak7p"))
503 (modules remove-pre-compiled-files-modules)
504 (snippet (remove-pre-compiled-files "pyc"))))
505 (arguments
506 (substitute-keyword-arguments (package-arguments python2-tegaki-wagomu)
507 ((#:phases _)
508 `(modify-phases %standard-phases
509 (add-after 'unpack 'pre-configure
510 (lambda* (#:key inputs #:allow-other-keys)
511 ;; Always convert string to unicode to avoid the following error
512 ;; when running "tegaki-build" in python2-tegaki-tools:
513 ;;
514 ;; sqlite3.ProgrammingError: You must not use 8-bit bytestrings
515 ;; unless you use a text_factory that can interpret 8-bit
516 ;; bytestrings (like text_factory = str).
517 ;; It is highly recommended that you instead just switch your
518 ;; application to Unicode strings.
519 (substitute* "tegaki/charcol.py"
520 (("sqlite3.OptimizedUnicode")
521 "lambda s: unicode(s, 'utf-8')"))
522 (substitute* "tegaki/engine.py"
523 (("/usr(/local)?")
524 (assoc-ref inputs "python2-tegaki-wagomu")))
525 #t))))))
526 ;; override inherited inputs
527 (inputs '())
528 (native-inputs '())
529 (propagated-inputs
530 `(("python2-tegaki-wagomu" ,python2-tegaki-wagomu)
531 ("python2-zinnia" ,python2-zinnia)))
532 (synopsis
533 "Chinese and Japanese Handwriting Recognition (Base python library)")
534 (license (list gpl2+ ; all files except...
535 bsd-3 ; dictutils.py
536 zpl2.1)))) ; minjson.py
58ac9289
AV
537
538(define-public python2-tegaki-pygtk
539 (package
540 (inherit python2-tegaki-wagomu)
541 (name "python2-tegaki-pygtk")
542 (version "0.3.1")
543 (source
544 (origin
545 (method url-fetch)
546 (uri (tegaki-release-uri "tegaki-pygtk" version))
547 (sha256
548 (base32
549 "1cip0azxhjdj2dg2z85cp1z3lz4qwx3w1j7z4xmcm7npapmsaqs2"))
550 (modules remove-pre-compiled-files-modules)
551 (snippet (remove-pre-compiled-files "pyc"))))
552 (arguments
553 (substitute-keyword-arguments (package-arguments python2-tegaki-wagomu)
554 ((#:phases _)
555 `(modify-phases %standard-phases
556 (add-after 'unpack 'fix-paths
557 (lambda* (#:key inputs #:allow-other-keys)
558 (substitute* "tegakigtk/fakekey.py"
559 (("libX11.so.6" so)
560 (string-append (assoc-ref inputs "libx11") "/lib/" so))
561 (("libXtst.so.6" so)
562 (string-append (assoc-ref inputs "libxtst") "/lib/" so)))
563 #t))))))
564 (inputs ; required for sending key strokes
565 `(("libx11" ,libx11)
566 ("libxtst" ,libxtst)))
567 (native-inputs '()) ; override inherited inputs
568 (propagated-inputs
569 `(("python2-pygtk" ,python2-pygtk)
570 ("python2-tegaki-python" ,python2-tegaki-python)))
571 (synopsis "Chinese and Japanese Handwriting Recognition (Base UI library)")
572 (license gpl2+))) ; all files
dd97a9c4
AV
573
574(define-public python2-tegaki-tools
575 (package
576 (inherit python2-tegaki-wagomu)
577 (name "python2-tegaki-tools")
578 (version "0.3.1")
579 (source
580 (origin
581 (method url-fetch)
582 (uri (tegaki-release-uri "tegaki-tools" version))
583 (sha256
584 (base32
585 "0xxv97ggh2jgldw3r7y59lv3fhz733r6l7mdn6nh4m0gvb0ja971"))
586 (modules remove-pre-compiled-files-modules)
587 (snippet (remove-pre-compiled-files "pyc"))))
588 (arguments
589 (substitute-keyword-arguments (package-arguments python2-tegaki-wagomu)
590 ((#:phases _) '%standard-phases)))
591 (inputs
592 `(("python2-tegaki-pygtk" ,python2-tegaki-pygtk)))
593 ;; override inherited inputs
594 (native-inputs '())
595 (propagated-inputs '())
596 (synopsis "Chinese and Japanese Handwriting Recognition (Advanced tools)")
597 ;; Files in gifenc/ are licensed under gpl3+ while other files are licensed
598 ;; under gpl2+. Therefore, the combined work is licensed under gpl3+.
599 (license gpl3+)))
e4f72a58
AV
600
601(define-public python2-tegaki-recognize
602 (let ((commit "eceec69fe651d0733c8c8752dae569d2283d0f3c")
603 (revision "1"))
604 (package
605 (inherit python2-tegaki-tools)
606 (name "python2-tegaki-recognize")
607 ;; version copied from <https://github.com/tegaki/tegaki/releases>
608 (version (git-version "0.3.1" revision commit))
609 (source
610 (origin
611 ;; We use GIT-FETCH because 'tegaki-recognize.desktop.in' and
612 ;; 'tegaki-recognize.in' are missing in the tarball.
613 (method git-fetch)
614 (uri (git-reference
615 (url "https://github.com/tegaki/tegaki.git")
616 (commit commit)))
617 (sha256
618 (base32
619 "09mw2if9p885phbgah5f95q3fwy7s5b46qlmpxqyzfcnj6g7afr5"))
620 (file-name (git-file-name name version))
621 (modules `((guix build utils)
622 (ice-9 ftw)
623 (srfi srfi-26)
624 ,@remove-pre-compiled-files-modules))
625 (snippet
626 `(begin
627 ;; remove unnecessary files with potentially different license
628 (for-each delete-file-recursively
629 (scandir "."
630 (negate (cut member <> '("tegaki-recognize"
631 "." "..")))))
632 ,(remove-pre-compiled-files "pyc")
633 #t))))
634 (arguments
635 (substitute-keyword-arguments (package-arguments python2-tegaki-tools)
636 ((#:phases _)
637 `(modify-phases %standard-phases
638 (add-after 'unpack 'chdir
639 (lambda _
640 (chdir "tegaki-recognize")
641 #t))
642 ;; 'setup.py' script does not support one of the Python build
643 ;; system's default flags, "--single-version-externally-managed"
644 (replace 'install
645 (lambda* (#:key outputs #:allow-other-keys)
646 (invoke "python" "setup.py" "install"
647 (string-append "--prefix=" (assoc-ref outputs "out"))
648 "--root=/")
649 #t))))))
650 (synopsis "Chinese and Japanese Handwriting Recognition (Main program)")
651 (license gpl2+)))) ; all files
3ed30b88
AV
652
653(define-public tegaki-zinnia-japanese
654 (package
655 (inherit python2-tegaki-wagomu)
656 (name "tegaki-zinnia-japanese")
657 (version "0.3")
658 (source
659 (origin
660 (method url-fetch)
661 (uri (tegaki-release-uri name version "zip"))
662 (sha256
663 (base32
664 "1nmg9acxhcqly9gwkyb9m0hpy76fll91ywk4b1q4xms0ajxip1h7"))
665 (modules remove-pre-compiled-files-modules)
666 (snippet (remove-pre-compiled-files "model"))))
667 (build-system gnu-build-system)
668 (arguments
669 `(#:tests? #f ; no tests
670 #:phases
671 (modify-phases %standard-phases
672 (replace 'configure
673 (lambda* (#:key outputs #:allow-other-keys)
674 (substitute* "Makefile"
675 (("/usr/local")
676 (assoc-ref outputs "out")))
677 #t)))))
678 ;; override inherited inputs
679 (inputs '())
680 (native-inputs
681 `(("python2-tegaki-tools" ,python2-tegaki-tools)))
682 (propagated-inputs '())
683 (native-search-paths
684 (list (search-path-specification
685 (variable "TEGAKI_MODEL_PATH")
686 (files '("share/tegaki/models")))))
687 (synopsis "Chinese and Japanese Handwriting Recognition (Model)")
688 (license lgpl2.1))) ; all files
c8bbd808
AV
689
690(define-public tegaki-zinnia-japanese-light
691 (package
692 (inherit tegaki-zinnia-japanese)
693 (name "tegaki-zinnia-japanese-light")
694 (version "0.3")
695 (source
696 (origin
697 (method url-fetch)
698 (uri (tegaki-release-uri name version "zip"))
699 (sha256
700 (base32
701 "0x0fs29ylqzxd6xvg51h7rigpbisd7q8v11df425ib2j792yfyf8"))
702 (modules remove-pre-compiled-files-modules)
703 (snippet (remove-pre-compiled-files "model"))))
704 (license lgpl2.1))) ; all files
5fd56748
AV
705
706(define-public tegaki-zinnia-japanese-kyoiku
707 (package
708 (inherit tegaki-zinnia-japanese)
709 (name "tegaki-zinnia-japanese-kyoiku")
710 (version "0.3")
711 (source
712 (origin
713 (method url-fetch)
714 (uri (tegaki-release-uri name version "zip"))
715 (sha256
716 (base32
717 "0am94bcpmbzplxdnwn9gk15sgaizvcfhmv13mk14jjvx3419cvvx"))
718 (modules remove-pre-compiled-files-modules)
719 (snippet (remove-pre-compiled-files "model"))))
720 (license lgpl2.1))) ; all files
8955412b
AV
721
722(define-public tegaki-zinnia-japanese-joyo
723 (package
724 (inherit tegaki-zinnia-japanese)
725 (name "tegaki-zinnia-japanese-joyo")
726 (version "0.3")
727 (source
728 (origin
729 (method url-fetch)
730 (uri (tegaki-release-uri name version "zip"))
731 (sha256
732 (base32
733 "1v0j40lzdyiz01ayws0b8r7fsdy2mr32658382kz4wyk883wzx2z"))
734 (modules remove-pre-compiled-files-modules)
735 (snippet (remove-pre-compiled-files "model"))))
736 (license lgpl2.1))) ; all files
e0679464
AV
737
738(define-public tegaki-zinnia-simplified-chinese
739 (package
740 (inherit tegaki-zinnia-japanese)
741 (name "tegaki-zinnia-simplified-chinese")
742 (version "0.3")
743 (source
744 (origin
745 (method url-fetch)
746 (uri (tegaki-release-uri name version "zip"))
747 (sha256
748 (base32
749 "18wq0jccv7lpnrfnzspyc110d6pj2v1i21xcx4fmgzz1lnln3fs5"))
750 (modules remove-pre-compiled-files-modules)
751 (snippet (remove-pre-compiled-files "model"))))
752 (license lgpl2.1))) ; all files
ca1f28bd
AV
753
754(define-public tegaki-zinnia-simplified-chinese-light
755 (package
756 (inherit tegaki-zinnia-japanese)
757 (name "tegaki-zinnia-simplified-chinese-light")
758 (version "0.3")
759 (source
760 (origin
761 (method url-fetch)
762 (uri (tegaki-release-uri name version "zip"))
763 (sha256
764 (base32
765 "0v24yf0w0p03lb7fyx128a75mwzad166bigvlbrzqnad789qg1sr"))
766 (modules remove-pre-compiled-files-modules)
767 (snippet (remove-pre-compiled-files "model"))))
768 (license lgpl2.1))) ; all files
0bfcc29d
AV
769
770(define-public tegaki-zinnia-traditional-chinese
771 (package
772 (inherit tegaki-zinnia-japanese)
773 (name "tegaki-zinnia-traditional-chinese")
774 (version "0.3")
775 (source
776 (origin
777 (method url-fetch)
778 (uri (tegaki-release-uri name version "zip"))
779 (sha256
780 (base32
781 "140nlp6hynrai2svs5670jjfw1za6ayflhyj2dl0bzsfgbk3447l"))
782 (modules remove-pre-compiled-files-modules)
783 (snippet (remove-pre-compiled-files "model"))))
784 (license lgpl2.1))) ; all files
caee9806
AV
785
786(define-public tegaki-zinnia-traditional-chinese-light
787 (package
788 (inherit tegaki-zinnia-japanese)
789 (name "tegaki-zinnia-traditional-chinese-light")
790 (version "0.3")
791 (source
792 (origin
793 (method url-fetch)
794 (uri (tegaki-release-uri name version "zip"))
795 (sha256
796 (base32
797 "1m6yk6a57vs9wg5y50qciwi1ahhmklp2mgsjysbj4mnyzv6yhcr2"))
798 (modules remove-pre-compiled-files-modules)
799 (snippet (remove-pre-compiled-files "model"))))
800 (license lgpl2.1))) ; all files
6b32e91a
AV
801
802(define-public tegaki-wagomu-japanese
803 (package
804 (inherit tegaki-zinnia-japanese)
805 (name "tegaki-wagomu-japanese")
806 (version "0.3")
807 (source
808 (origin
809 (method url-fetch)
810 (uri (tegaki-release-uri name version "zip"))
811 (sha256
812 (base32
813 "0flj5id8xwsn7csrrzqz9prdikswnwm2wms0as2vzdpxzph1az4k"))
814 (modules remove-pre-compiled-files-modules)
815 (snippet (remove-pre-compiled-files "model"))))
816 (license lgpl2.1))) ; all files
ee3dc52b
AV
817
818(define-public tegaki-wagomu-japanese-kyoiku
819 (package
820 (inherit tegaki-zinnia-japanese)
821 (name "tegaki-wagomu-japanese-kyoiku")
822 (version "0.3")
823 (source
824 (origin
825 (method url-fetch)
826 (uri (tegaki-release-uri name version "zip"))
827 (sha256
828 (base32
829 "0v8crfh8rdf6ndp16g52s5jlrrlwh73xp38zjn5i9dlacx8kfqg1"))
830 (modules remove-pre-compiled-files-modules)
831 (snippet (remove-pre-compiled-files "model"))))
832 (license lgpl2.1))) ; all files
7c25904c
AV
833
834(define-public tegaki-wagomu-japanese-joyo
835 (package
836 (inherit tegaki-zinnia-japanese)
837 (name "tegaki-wagomu-japanese-joyo")
838 (version "0.3")
839 (source
840 (origin
841 (method url-fetch)
842 (uri (tegaki-release-uri name version "zip"))
843 (sha256
844 (base32
845 "0wk8shpr963zp328g991qs6abpnacq4242003m687z2d6yp7nph2"))
846 (modules remove-pre-compiled-files-modules)
847 (snippet (remove-pre-compiled-files "model"))))
848 (license lgpl2.1))) ; all files
708c6857
AV
849
850(define-public tegaki-wagomu-simplified-chinese
851 (package
852 (inherit tegaki-zinnia-japanese)
853 (name "tegaki-wagomu-simplified-chinese")
854 (version "0.3")
855 (source
856 (origin
857 (method url-fetch)
858 (uri (tegaki-release-uri name version "zip"))
859 (sha256
860 (base32
861 "0wqprynigqxqxv128i1smh81gxvmjj056d9qpznxa3n9f5ymlbj6"))
862 (modules remove-pre-compiled-files-modules)
863 (snippet (remove-pre-compiled-files "model"))))
864 (license lgpl2.1))) ; all files
0ed97e69
AV
865
866;;; Upstream does not provide the source for tegaki-wagomu-traditional-chinese.
867;;; Therefore, we use the source for tegaki-zinnia-traditional-chinese and
868;;; patch the Makefile accordingly.
869(define-public tegaki-wagomu-traditional-chinese
870 (package
871 (inherit tegaki-zinnia-traditional-chinese)
872 (name "tegaki-wagomu-traditional-chinese")
873 (arguments
874 (substitute-keyword-arguments
875 (package-arguments tegaki-zinnia-traditional-chinese)
876 ((#:phases phases '%standard-phases)
877 `(modify-phases ,phases
878 (replace 'configure
879 (lambda args
880 (let ((configure (assq-ref ,phases 'configure)))
881 (apply configure args))
882 (substitute* "Makefile"
883 (("zinnia") "wagomu"))
884 #t))))))
885 (license lgpl2.1))) ; all files