gnu: emacspeak: Fix Tclx and espeak server loading.
[jackhill/guix/guix.git] / gnu / packages / dictionaries.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2016, 2017, 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016 Sou Bunnbu <iyzsong@gmail.com>
5 ;;; Copyright © 2017, 2018, 2019, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
6 ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Pierre-Antoine Rouby <contact@parouby.fr>
8 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
9 ;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
10 ;;; Copyright © 2020 Lu hux <luhux@outlook.com>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
18 ;;;
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27 (define-module (gnu packages dictionaries)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix download)
31 #:use-module (guix git-download)
32 #:use-module (guix build-system gnu)
33 #:use-module (guix build-system python)
34 #:use-module (guix build-system trivial)
35 #:use-module (guix build-system copy)
36 #:use-module (guix build-system cmake)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages autotools)
39 #:use-module (gnu packages base)
40 #:use-module (gnu packages curl)
41 #:use-module (gnu packages emacs)
42 #:use-module (gnu packages flex)
43 #:use-module (gnu packages fribidi)
44 #:use-module (gnu packages gettext)
45 #:use-module (gnu packages glib)
46 #:use-module (gnu packages linux)
47 #:use-module (gnu packages ncurses)
48 #:use-module (gnu packages pcre)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages readline)
52 #:use-module (gnu packages texinfo)
53 #:use-module (gnu packages compression)
54 #:use-module (gnu packages tcl)
55 #:use-module (gnu packages xml))
56
57
58 (define-public vera
59 (package
60 (name "vera")
61 (version "1.24")
62 (source (origin
63 (method url-fetch)
64 (uri (string-append "mirror://gnu/vera/vera-" version
65 ".tar.gz"))
66 (sha256
67 (base32
68 "1j5p679vw72bv766acbg6g89k31ynmrzlpg7s3wzy4krlwdf92xc"))))
69 (build-system trivial-build-system)
70 (arguments
71 `(#:builder (begin
72 (use-modules (guix build utils))
73
74 (let* ((out (assoc-ref %outputs "out"))
75 (info (string-append out "/share/info"))
76 (html (string-append out "/share/html"))
77 (source (assoc-ref %build-inputs "source"))
78 (tar (assoc-ref %build-inputs "tar"))
79 (gz (assoc-ref %build-inputs "gzip"))
80 (texi (assoc-ref %build-inputs "texinfo")))
81 (setenv "PATH" (string-append gz "/bin"))
82 (invoke (string-append tar "/bin/tar") "xvf" source)
83
84 (chdir (string-append "vera-" ,version))
85 (mkdir-p info)
86 (mkdir-p html)
87
88 ;; Change a ‘Malformed UTF-8 character: \xd7\x34 (unexpected
89 ;; non-continuation byte 0x34, immediately after start byte
90 ;; 0xd7; need 2 bytes, got 1) in pattern match (m//)’.
91 (substitute* "vera.h"
92 (("320.480") "320x480"))
93
94 ;; XXX: Use '--force' because the document is unhappy
95 ;; with Texinfo 5 (yes, documents can be unhappy.)
96 (invoke (string-append texi "/bin/makeinfo")
97 "vera.texi" "--force" "-o"
98 (string-append info "/vera.info"))
99 (invoke (string-append texi "/bin/makeinfo")
100 "vera.texi" "--force" "--html" "-o"
101 (string-append html "/vera.html"))))
102 #:modules ((guix build utils))))
103 (native-inputs `(("texinfo" ,texinfo)
104 ("tar" ,tar)
105 ("gzip" ,gzip)))
106 (home-page "https://savannah.gnu.org/projects/vera/")
107 (synopsis "List of acronyms")
108 (description
109 "V.E.R.A. (Virtual Entity of Relevant Acronyms) is a list of computing
110 acronyms distributed as an info document.")
111 (license license:fdl1.3+)))
112
113 (define-public gcide
114 (package
115 (name "gcide")
116 (version "0.52")
117 (source (origin
118 (method url-fetch)
119 (uri (string-append
120 "mirror://gnu/gcide/gcide-" version ".tar.xz"))
121 (sha256
122 (base32
123 "1n3bp91sik66z3ca7mjqbr9nck3hg5ck0c8g84xc0qnfpx5vznh2"))))
124 (build-system copy-build-system)
125 (arguments
126 '(#:install-plan
127 '(("." "share/gcide/" #:exclude ("COPYING")))))
128 (synopsis "GNU Collaborative International Dictionary of English")
129 (description
130 "GCIDE is a free dictionary based on a combination of sources. It can
131 be used via the GNU Dico program or accessed online at
132 http://gcide.gnu.org.ua/")
133 (home-page "https://gcide.gnu.org.ua/")
134 (license license:gpl3+)))
135
136 (define-public diction
137 ;; Not quite a dictionary, not quite a spell checker either…
138 (package
139 (name "diction")
140 (version "1.14")
141 (source
142 (origin
143 (method url-fetch)
144 (uri (string-append "http://www.moria.de/~michael/diction/diction-"
145 version ".tar.gz"))
146 (sha256
147 (base32 "1z6p5x3l1a00h4v4s33qa82fznzc1jdqdnlc4dnmd9nblnrjy0fs"))))
148 (build-system gnu-build-system)
149 (synopsis "Identifies wordy and commonly misused phrases")
150 (description
151 "A package providing two classic Unix commands, style and diction.
152 Diction is used to identify wordy and commonly misused phrases in a
153 body of text. Style instead analyzes surface aspects of a written
154 work, such as sentence length and other readability measures.")
155 (home-page "https://www.gnu.org/software/diction/")
156 (license license:gpl3+)))
157
158 (define-public ding
159 (package
160 (name "ding")
161 (version "1.8.1")
162 (source (origin
163 (method url-fetch)
164 (uri (string-append "http://ftp.tu-chemnitz.de/pub/Local/urz/" name
165 "/" name "-" version ".tar.gz"))
166 (sha256
167 (base32
168 "0chjqs3z9zs1w3l7b5lsaj682rgnkf9kibcbzhggqqcn1pbvl5sq"))))
169 (build-system gnu-build-system)
170 (inputs `(("tk" ,tk)))
171 (arguments
172 `(#:phases
173 (modify-phases %standard-phases
174 (delete 'configure)
175 (delete 'build)
176 (delete 'check)
177 (replace 'install
178 (lambda _
179 (let ((bindir (string-append
180 (assoc-ref %outputs "out") "/bin"))
181 (wish (string-append
182 (assoc-ref %build-inputs "tk")
183 "/bin/wish8.6"))
184 (sharedir (string-append
185 (assoc-ref %outputs "out")
186 "/share/applications"))
187 (libdir (string-append
188 (assoc-ref %outputs "out") "/lib")))
189 (mkdir-p bindir)
190 (mkdir-p libdir)
191 (mkdir-p sharedir)
192
193 (substitute* "ding.desktop"
194 (("Exec=/usr/bin/ding")
195 (string-append "Exec=" bindir "/ding")))
196 (with-fluids ((%default-port-encoding "ISO-8859-1"))
197 (substitute* "ding" (("exec wish") (string-append "exec " wish))))
198 (substitute* "install.sh"
199 (("/bin/cp") "cp")
200 (("/bin/mv") "mv")
201 (("NEEDPROG=\"wish\"")
202 (string-append "NEEDPROG=\"" wish "\""))
203 (("DEFBINDIR=\"/usr/local/bin\"")
204 (string-append "DEFBINDIR=\"" bindir "\""))
205 (("DEFLIBDIR=\"/usr/local/lib\"")
206 (string-append "DEFLIBDIR=\"" libdir "\"")))
207 (install-file "ding.desktop" sharedir)
208 (install-file "ding.png" sharedir)
209 (invoke "./install.sh")))))))
210 (synopsis "Dictionary lookup program with a German-English dictionary")
211 (description "Ding is a dictionary lookup program for the X window system.
212 It comes with a German-English dictionary with approximately 270,000 entries.")
213 (home-page "https://www-user.tu-chemnitz.de/~fri/ding/")
214 (license license:gpl2+)))
215
216 (define-public grammalecte
217 (package
218 (name "grammalecte")
219 (version "2.1.1")
220 (source
221 (origin
222 (method url-fetch/zipbomb)
223 (uri (string-append "https://grammalecte.net/grammalecte/zip/"
224 "Grammalecte-fr-v" version ".zip"))
225 (sha256
226 (base32 "076jv3ywdgqqzg92bfbagc7ypy08xjq5zn4vgna6j9350fkfqhzn"))))
227 (build-system python-build-system)
228 (home-page "https://grammalecte.net")
229 (synopsis "French spelling and grammar checker")
230 (description "Grammalecte is a grammar checker for the French language,
231 derived from Lightproof.
232
233 Grammalecte helps writing a proper French, without distracting users with
234 false positives. This grammar checker follows the principle: the less false
235 positives, the better; if it cannot know with a good chance that a dubious
236 expression is wrong, it keeps silent.
237
238 The package provides the command line interface, along with a server
239 and a Python library.")
240 (license license:gpl3+)))
241
242 (define-public translate-shell
243 (package
244 (name "translate-shell")
245 (version "0.9.6.12")
246 (source
247 (origin
248 (method git-fetch)
249 (uri (git-reference
250 (url"https://github.com/soimort/translate-shell")
251 (commit (string-append "v" version))))
252 (file-name (git-file-name name version))
253 (sha256
254 (base32 "075vqnha21rhr1b61dim7dqlfwm1yffyzcaa83s36rpk9r5sddzx"))))
255 (build-system gnu-build-system)
256 (arguments
257 `(#:phases
258 (modify-phases %standard-phases
259 (delete 'configure) ; no configure script
260 (add-after 'unpack 'remove-unnecessary-file
261 ;; This file gets generated during the build phase.
262 (lambda _
263 (delete-file "translate")
264 #t))
265 (add-after 'install 'wrap-binary
266 (lambda* (#:key inputs outputs #:allow-other-keys)
267 (let* ((out (assoc-ref outputs "out"))
268 (bin (string-append out "/bin/trans"))
269 (curl (assoc-ref inputs "curl"))
270 (fribidi (assoc-ref inputs "fribidi"))
271 (rlwrap (assoc-ref inputs "rlwrap")))
272 (wrap-program bin
273 `("PATH" ":" prefix
274 (,(string-append out "/bin:"
275 curl "/bin:"
276 fribidi "/bin:"
277 rlwrap "/bin")))))
278 #t))
279 (add-after 'install 'emacs-install
280 (lambda* (#:key inputs outputs #:allow-other-keys)
281 (let* ((out (assoc-ref outputs "out"))
282 (dest (string-append out "/share/emacs/site-lisp"))
283 (emacs (string-append (assoc-ref inputs "emacs") "/bin/emacs")))
284 (install-file "google-translate-mode.el" dest)
285 (emacs-generate-autoloads ,name dest)))))
286 #:make-flags (list (string-append "PREFIX=" %output)
287 "NETWORK_ACCESS=no test")
288 #:imported-modules (,@%gnu-build-system-modules (guix build emacs-utils))
289 #:modules ((guix build gnu-build-system)
290 (guix build emacs-utils)
291 (guix build utils))
292 #:test-target "test"))
293 (inputs
294 `(("curl" ,curl)
295 ("fribidi" ,fribidi)
296 ("rlwrap" ,rlwrap)))
297 (native-inputs
298 `(("emacs" ,emacs-minimal)
299 ("util-linux" ,util-linux))) ; hexdump, for the test
300 (home-page "https://www.soimort.org/translate-shell/")
301 (synopsis "Translations from the command line")
302 (description
303 "Translate Shell (formerly Google Translate CLI) is a command-line
304 translator powered by Google Translate (default), Bing Translator,
305 Yandex.Translate and Apertium. It gives you easy access to one of these
306 translation engines from your terminal.")
307 (license license:public-domain)))
308
309 (define-public lttoolbox
310 (package
311 (name "lttoolbox")
312 (version "3.5.3")
313 (source
314 (origin
315 (method url-fetch)
316 (uri (string-append
317 "https://github.com/apertium/lttoolbox/releases/download/v"
318 version "/lttoolbox-" version ".tar.bz2"))
319 (sha256
320 (base32 "109l91ailish1a3vya5zmfg3kb67cwyzl36ndnh8f59chsbm6n2f"))))
321 (build-system gnu-build-system)
322 (arguments
323 `(#:phases
324 (modify-phases %standard-phases
325 (replace 'bootstrap
326 ;; The included ./autogen.sh unconditionally runs ./configure before
327 ;; its shebangs have been patched.
328 (lambda _
329 (invoke "autoreconf" "-vfi"))))))
330 (inputs
331 `(("libxml2" ,libxml2)))
332 (native-inputs
333 `(("autoconf" ,autoconf)
334 ("automake" ,automake)
335 ("libtool" ,libtool)
336 ("pkg-config" ,pkg-config)))
337 (home-page "https://wiki.apertium.org/wiki/Lttoolbox")
338 (synopsis "Lexical processing toolbox")
339 (description "Lttoolbox is a toolbox for lexical processing, morphological
340 analysis and generation of words. Analysis is the process of splitting a
341 word (e.g. cats) into its lemma \"cat\" and the grammatical information
342 @code{<n><pl>}. Generation is the opposite process.")
343 (license (list license:gpl2 ; main license
344 license:expat)))) ; utf8/*
345
346 (define-public apertium
347 (package
348 (name "apertium")
349 (version "3.5.2")
350 (source
351 (origin
352 (method url-fetch)
353 (uri (string-append
354 "https://github.com/apertium/apertium/releases/download/v"
355 version "/apertium-" version ".tar.gz"))
356 (sha256
357 (base32
358 "0lrx58ipx2kzh1pd3xm1viz05dqyrq38jbnj9dnk92c9ckkwkp4h"))
359 (file-name (string-append name "-" version ".tar.gz"))))
360 (build-system gnu-build-system)
361 (inputs
362 `(("libxml2" ,libxml2)
363 ("libxslt" ,libxslt)
364 ("lttoolbox" ,lttoolbox)
365 ("pcre" ,pcre)))
366 (native-inputs
367 `(("apertium-get"
368 ,(origin
369 (method git-fetch)
370 (uri (git-reference
371 (url "https://github.com/apertium/apertium-get")
372 (commit "692d030e68008fc123089cf2446070fe8c6e3a3b")))
373 (sha256
374 (base32
375 "0kgp68azvds7yjwfz57z8sa5094fyk5yr0qxzblrw7bisrrihnav"))))
376 ("flex" ,flex)
377 ("pkg-config" ,pkg-config)
378 ;; python is only required for running the test suite
379 ("python" ,python)))
380 (arguments
381 `(#:phases
382 (modify-phases %standard-phases
383 ;; If apertium-get does not exist in the source tree, the build tries
384 ;; to download it using an svn checkout. To avoid this, copy
385 ;; apertium-get into the source tree.
386 (add-after 'unpack 'unpack-apertium-get
387 (lambda* (#:key inputs #:allow-other-keys)
388 (copy-recursively (assoc-ref inputs "apertium-get")
389 "apertium/apertium-get")
390 #t)))))
391 (home-page "https://www.apertium.org/")
392 (synopsis "Rule based machine translation system")
393 (description "Apertium is a rule based machine translation system
394 featuring a shallow-transfer machine translation engine. The design of the
395 system makes translations fast (translating tens of thousands of words per
396 second on ordinary desktop computers) and, in spite of the errors, reasonably
397 intelligible and easily correctable.")
398 (license (list license:gpl2 ; main license
399 license:expat)))) ; utf8/*
400
401 (define-public sdcv
402 (package
403 (name "sdcv")
404 (version "0.5.3")
405 (source
406 (origin
407 (method git-fetch)
408 (uri (git-reference
409 (url "https://github.com/Dushistov/sdcv/")
410 (commit (string-append "v" version))))
411 (file-name (git-file-name name version))
412 (sha256
413 (base32
414 "144qpl9b8r2php0zhi9b7vg6flpvdgjy6yfaipydwwhxi4wy9600"))))
415 (build-system cmake-build-system)
416 (arguments
417 `(#:configure-flags '("-DBUILD_TESTS=YES")
418 #:phases
419 (modify-phases %standard-phases
420 (add-after 'build 'build-lang
421 (lambda _
422 (invoke "make" "lang")))
423 (add-before 'check 'pre-check
424 (lambda _
425 (setenv "HOME" (getcwd))
426 #t))
427 (add-after 'unpack 'remove-jq-requirement
428 (lambda _
429 ;; We don't want to bring in jq for one test.
430 (substitute* "tests/t_json"
431 (("jq") "echo"))
432 #t)))))
433 (native-inputs
434 `(("gettext" ,gettext-minimal)
435 ("pkg-config" ,pkg-config)))
436 (inputs
437 `(("glib" ,glib)
438 ("ncurses" ,ncurses)
439 ("readline" ,readline)
440 ("zlib" ,zlib)))
441 ;; If you use Guix to package and install dictionary data,
442 ;; you need this variable to load them.
443 (native-search-paths
444 (list (search-path-specification
445 (variable "STARDICT_DATA_DIR")
446 (files '("share/stardict/dic")))))
447 (home-page "https://dushistov.github.io/sdcv/")
448 (synopsis "Console version of StarDict")
449 (description "sdcv is simple text-based utility for work with dictionaries
450 in StarDict's format.")
451 (license license:gpl2+)))