Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / language.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016 Eric Bavier <bavier@member.fsf.org>
3 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2018 ng0 <ng0@n0.is>
5 ;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
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)
24 #:use-module (gnu packages glib)
25 #:use-module (gnu packages gtk)
26 #:use-module (gnu packages ocr)
27 #:use-module (gnu packages perl)
28 #:use-module (gnu packages pkg-config)
29 #:use-module (gnu packages python)
30 #:use-module (gnu packages perl-check)
31 #:use-module (gnu packages swig)
32 #:use-module (gnu packages web)
33 #:use-module (gnu packages xorg)
34 #:use-module (guix packages)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system perl)
37 #:use-module (guix build-system python)
38 #:use-module ((guix licenses)
39 #:select
40 (bsd-3 gpl2 gpl2+ gpl3 gpl3+ lgpl2.1 perl-license zpl2.1))
41 #:use-module (guix download)
42 #:use-module (guix git-download)
43 #:use-module (guix utils))
44
45 (define-public perl-lingua-en-findnumber
46 (package
47 (name "perl-lingua-en-findnumber")
48 (version "1.32")
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
56 "015ximzdp42v824llwlg2pd77vd0d172lb4xs55q9f9zhqf6s5qx"))))
57 (build-system perl-build-system)
58 (propagated-inputs
59 `(("perl-lingua-en-words2nums" ,perl-lingua-en-words2nums)))
60 (home-page "https://metacpan.org/release/Lingua-EN-FindNumber")
61 (synopsis "Locate (written) numbers in English text ")
62 (description "This module provides a regular expression for finding
63 numbers in English text. It also provides functions for extracting and
64 manipulating such numbers.")
65 (license perl-license)))
66
67 (define-public perl-lingua-en-inflect
68 (package
69 (name "perl-lingua-en-inflect")
70 (version "1.903")
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
78 "0j8d1f1wvmgc11d71pc8xp8fv5a1nb2yfw1dgd19xhscn1klpvzw"))))
79 (build-system perl-build-system)
80 (native-inputs `(("perl-module-build" ,perl-module-build)))
81 (home-page "https://metacpan.org/release/Lingua-EN-Inflect")
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
85 words. Plural forms of all nouns, most verbs, and some adjectives are
86 provided. Where appropriate, \"classical\" variants (for example: \"brother\"
87 -> \"brethren\", \"dogma\" -> \"dogmata\", etc.) are also provided.")
88 (license perl-license)))
89
90 (define-public perl-lingua-en-inflect-number
91 (package
92 (name "perl-lingua-en-inflect-number")
93 (version "1.12")
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
101 "1gxccynkaqav43ww43jp4rzkyr36x97jd03yb5f6yx0jhn1k7yv6"))))
102 (build-system perl-build-system)
103 (propagated-inputs
104 `(("perl-lingua-en-inflect" ,perl-lingua-en-inflect)))
105 (home-page "https://metacpan.org/release/Lingua-EN-Inflect-Number")
106 (synopsis "Force number of words to singular or plural")
107 (description "This module extends the functionality of Lingua::EN::Inflect
108 with three new functions for determining plurality of a word and forcefully
109 converting a word to singular or plural.")
110 (license perl-license)))
111
112 (define-public perl-lingua-en-inflect-phrase
113 (package
114 (name "perl-lingua-en-inflect-phrase")
115 (version "0.20")
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
123 "1a6y1l2pjim2242wcpgz066di4pbzfgsjjdl7vg5a5wzm48qj1am"))))
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)))
133 (home-page "https://metacpan.org/release/Lingua-EN-Inflect-Phrase")
134 (synopsis "Inflect short English phrases")
135 (description "This module attempts to pluralize or singularize short
136 English phrases.")
137 (license perl-license)))
138
139 (define-public perl-lingua-en-number-isordinal
140 (package
141 (name "perl-lingua-en-number-isordinal")
142 (version "0.05")
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
150 "1mhqjvh2ad30gjab5b3a6mbr4aysyrscp4wp42yy5x6001a6km98"))))
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)))
157 (home-page "https://metacpan.org/release/Lingua-EN-Number-IsOrdinal")
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
160 digits, is a cardinal or ordinal number.")
161 (license perl-license)))
162
163 (define-public perl-lingua-en-tagger
164 (package
165 (name "perl-lingua-en-tagger")
166 (version "0.30")
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
174 "0nrnkvsf9f0a7lp82sanmy89ms2nqq1lvjqicvsagsvzp513bl5b"))))
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)))
181 (home-page "https://metacpan.org/release/Lingua-EN-Tagger")
182 (synopsis "Part-of-speech tagger for English natural language processing")
183 (description "This module is a probability based, corpus-trained tagger
184 that assigns part-of-speech tags to English text based on a lookup dictionary
185 and a set of probability values. The tagger assigns appropriate tags based on
186 conditional probabilities - it examines the preceding tag to determine the
187 appropriate tag for the current word. Unknown words are classified according
188 to word morphology or can be set to be treated as nouns or other parts of
189 speech. The tagger also extracts as many nouns and noun phrases as it can,
190 using a set of regular expressions.")
191 (license gpl3)))
192
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)
206 (home-page "https://metacpan.org/release/Lingua-EN-Words2Nums")
207 (synopsis "Convert English text to numbers")
208 (description "This module converts English text into numbers. It supports
209 both ordinal and cardinal numbers, negative numbers, and very large numbers.")
210 (license perl-license)))
211
212 (define-public perl-lingua-pt-stemmer
213 (package
214 (name "perl-lingua-pt-stemmer")
215 (version "0.02")
216 (source
217 (origin
218 (method url-fetch)
219 (uri (string-append "mirror://cpan/authors/id/N/NE/NEILB/"
220 "Lingua-PT-Stemmer-" version ".tar.gz"))
221 (sha256
222 (base32
223 "17c48sfbgwd2ivlgf59sr6jdhwa3aim8750f8pyzz7xpi8gz0var"))))
224 (build-system perl-build-system)
225 (home-page "https://metacpan.org/release/Lingua-PT-Stemmer")
226 (synopsis "Portuguese language stemming")
227 (description "This module implements a Portuguese stemming algorithm
228 proposed in the paper A Stemming Algorithm for the Portuguese Language by
229 Moreira, V. and Huyck, C.")
230 (license perl-license)))
231
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)
245 (native-inputs
246 `(("perl-module-build" ,perl-module-build)))
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)))
256 (home-page "https://metacpan.org/release/Lingua-Stem")
257 (synopsis "Stemming of words in various languages")
258 (description "This routine applies stemming algorithms to its parameters,
259 returning the stemmed words as appropriate to the selected locale.")
260 (license perl-license)))
261
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)
275 (home-page "https://metacpan.org/release/Lingua-Stem-Fr")
276 (synopsis "Porter's stemming algorithm for French")
277 (description "This module uses a modified version of the Porter Stemming
278 Algorithm to return a stemmed French word.")
279 (license perl-license)))
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)
294 (home-page "https://metacpan.org/release/Lingua-Stem-It")
295 (synopsis "Porter's stemming algorithm for Italian")
296 (description "This module applies the Porter Stemming Algorithm to its
297 parameters, returning the stemmed Italian word.")
298 (license perl-license)))
299
300 (define-public perl-lingua-stem-ru
301 (package
302 (name "perl-lingua-stem-ru")
303 (version "0.04")
304 (source
305 (origin
306 (method url-fetch)
307 (uri (string-append "mirror://cpan/authors/id/N/NE/NEILB/"
308 "Lingua-Stem-Ru-" version ".tar.gz"))
309 (sha256
310 (base32
311 "0a2jmdz7jn32qj5hyiw5kbv8fvlpmws8i00a6xcbkzb48yvwww0j"))))
312 (build-system perl-build-system)
313 (home-page "https://metacpan.org/release/Lingua-Stem-Ru")
314 (synopsis "Porter's stemming algorithm for Russian")
315 (description "This module applies the Porter Stemming Algorithm to its
316 parameters, returning the stemmed Russian (KOI8-R only) word.")
317 (license perl-license)))
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)
332 (home-page "https://metacpan.org/release/Lingua-Stem-Snowball-Da")
333 (synopsis "Porters stemming algorithm for Danish")
334 (description "Lingua::Stem::Snowball::Da is a perl port of the danish
335 stemmer at http://snowball.sourceforge.net, it was originally altered from the
336 Lingua::Stem::Snowball::Se.")
337 (license gpl2)))
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)
352 (native-inputs `(("perl-module-build" ,perl-module-build)))
353 (home-page "https://metacpan.org/release/Snowball-Norwegian")
354 (synopsis "Porters stemming algorithm for Norwegian")
355 (description "Lingua::Stem::Snowball::No is a perl port of the norwegian
356 stemmer at http://snowball.tartarus.org.")
357 (license perl-license)))
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)
372 (native-inputs `(("perl-module-build" ,perl-module-build)))
373 (home-page "https://metacpan.org/release/Snowball-Swedish")
374 (synopsis "Porters stemming algorithm for Swedish")
375 (description "Lingua::Stem::Snowball::Se is a perl port of the swedish
376 stemmer at http://snowball.sourceforge.net.")
377 (license perl-license)))
378
379 (define-public perl-string-toidentifier-en
380 (package
381 (name "perl-string-toidentifier-en")
382 (version "0.12")
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
390 "12nw7h2yiybhdw0vnnpc7bif8ylhsn6kqf6s39dsrf9h54iq9yrs"))))
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)))
396 (home-page "https://metacpan.org/release/String-ToIdentifier-EN")
397 (synopsis "Convert strings to English program identifiers")
398 (description "This module provides a utility method, \"to_identifier\" for
399 converting an arbitrary string into a readable representation using the ASCII
400 subset of \"\\w\" for use as an identifier in a computer program. The intent
401 is to make unique identifier names from which the content of the original
402 string can be easily inferred by a human just by reading the identifier.")
403 (license perl-license)))
404
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)
418 (home-page "https://metacpan.org/release/Text-German")
419 (synopsis "German grundform reduction")
420 (description "This module is a rather incomplete implementation of work
421 done by Gudrun Putze-Meier.")
422 (license perl-license)))
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
432 extensions 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
486 modern implementation of handwriting recognition software, specifically
487 designed for Chinese (simplified and traditional) and Japanese, and that is
488 suitable for both the desktop and mobile devices.")
489 (license gpl2+))) ; all files
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
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
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+)))
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
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
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
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
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
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
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
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
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
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
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
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
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
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