GNU bug report logs - #75063
[PATCH 0/2] Easy configuration of FreeDict into dicod-service-type

Previous Next

Package: guix-patches;

Reported by: Runciter <runciter <at> whispers-vpn.org>

Date: Tue, 24 Dec 2024 12:48:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 75063 in the body.
You can then email your comments to 75063 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#75063; Package guix-patches. (Tue, 24 Dec 2024 12:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Runciter <runciter <at> whispers-vpn.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 24 Dec 2024 12:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Runciter <runciter <at> whispers-vpn.org>
To: guix-patches <at> gnu.org
Cc: Runciter <runciter <at> whispers-vpn.org>
Subject: [PATCH 0/2] Easy configuration of FreeDict into dicod-service-type
Date: Tue, 24 Dec 2024 12:47:22 +0000
A few weeks my patch for FreeDict multilingual dictionaries for Guix was
integrated to the master branch (bug #74411).

These patches are simple updates to the (gnu services dict) module and to the
Guix info manual to help users configure FreeDict dictionaries into their
local dicod server.

Regards,
Runciter

Runciter (2):
  gnu: dict: Add symbols to help users configure FreeDict with dicod.
  doc: add FreeDict dictionaries to dicod configuration example.

 doc/guix.texi         |   8 ++--
 gnu/services/dict.scm | 107 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 111 insertions(+), 4 deletions(-)


base-commit: 9dc91360fd2e41fb783ab4af341ac60aee2f5d31
-- 
2.46.0






Information forwarded to guix-patches <at> gnu.org:
bug#75063; Package guix-patches. (Tue, 24 Dec 2024 13:01:01 GMT) Full text and rfc822 format available.

Message #8 received at 75063 <at> debbugs.gnu.org (full text, mbox):

From: Runciter <runciter <at> whispers-vpn.org>
To: 75063 <at> debbugs.gnu.org
Cc: Runciter <runciter <at> whispers-vpn.org>
Subject: [PATCH 1/2] gnu: dict: Add symbols to help users configure FreeDict
 with dicod.
Date: Tue, 24 Dec 2024 13:00:45 +0000
* gnu/services/dict.scm: (%dictorg-handler): New variable;
(freedict-dictorg-database): new procedure;
(%freedict-dictorg-databases): new variable.

Signed-off-by: Runciter <runciter <at> whispers-vpn.org>
---
 gnu/services/dict.scm | 107 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 106 insertions(+), 1 deletion(-)

diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index a4e25f5302..39fb38c9c3 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2016 Sou Bunnbu <iyzsong <at> gmail.com>
 ;;; Copyright © 2016, 2017, 2018, 2020, 2022, 2023 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2017 Huang Ying <huang.ying.caritas <at> gmail.com>
+;;; Copyright © 2024 Runciter <runciter <at> whispers-vpn.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -40,7 +41,10 @@ (define-module (gnu services dict)
             dicod-configuration
             dicod-handler
             dicod-database
-            %dicod-database:gcide))
+            %dicod-database:gcide
+            %dictorg-handler
+            freedict-dictorg-database
+            %freedict-dictorg-databases))
 
 
 ;;;
@@ -94,6 +98,107 @@ (define %dicod-database:gcide
    (options (list #~(string-append "dbdir=" #$gcide "/share/gcide")
                   #~(string-append "idxdir=" #$%dicod-gcide-index)))))
 
+(define %dictorg-handler
+  (dicod-handler (name "dictorg")
+                 (module "dictorg")
+                 (options (list #~(string-append "dbdir=/")))))
+
+(define (freedict-dictorg-database dict-name)
+  "Return a record of type @code{<dicod-database>} that configures a
+database for the freedict multilingual dictionary named by the string
+DICT-NAME."
+  (dicod-database (name (string-append "freedict-"
+                                       dict-name))
+                  (complex? #t)
+                  (handler "dictorg")
+                  (options (list #~(string-append "database="
+                                                  #$freedict-dictionaries
+                                                  "/share/dictd/"
+                                                  #$dict-name)))))
+
+(define %freedict-dictorg-databases
+  (map freedict-dictorg-database (list "afr-deu"
+                                       "afr-eng"
+                                       "ara-eng"
+                                       "bre-fra"
+                                       "ces-eng"
+                                       "ckb-kmr"
+                                       "cym-eng"
+                                       "dan-eng"
+                                       "deu-ita"
+                                       "deu-kur"
+                                       "deu-nld"
+                                       "deu-por"
+                                       "deu-tur"
+                                       "eng-afr"
+                                       "eng-ara"
+                                       "eng-ces"
+                                       "eng-cym"
+                                       "eng-dan"
+                                       "eng-ell"
+                                       "eng-fra"
+                                       "eng-gle"
+                                       "eng-hin"
+                                       "eng-hrv"
+                                       "eng-hun"
+                                       "eng-ita"
+                                       "eng-lat"
+                                       "eng-lit"
+                                       "eng-nld"
+                                       "eng-pol"
+                                       "eng-por"
+                                       "eng-rom"
+                                       "eng-rus"
+                                       "eng-spa"
+                                       "eng-srp"
+                                       "eng-swh"
+                                       "eng-tur"
+                                       "fra-bre"
+                                       "fra-eng"
+                                       "fra-nld"
+                                       "gla-deu"
+                                       "gle-eng"
+                                       "gle-pol"
+                                       "hrv-eng"
+                                       "hun-eng"
+                                       "isl-eng"
+                                       "ita-deu"
+                                       "ita-eng"
+                                       "jpn-deu"
+                                       "jpn-eng"
+                                       "jpn-fra"
+                                       "jpn-rus"
+                                       "kha-deu"
+                                       "kha-eng"
+                                       "kur-deu"
+                                       "kur-eng"
+                                       "kur-tur"
+                                       "lat-deu"
+                                       "lat-eng"
+                                       "lit-eng"
+                                       "mkd-bul"
+                                       "nld-deu"
+                                       "nld-eng"
+                                       "nld-fra"
+                                       "nno-nob"
+                                       "oci-cat"
+                                       "pol-gle"
+                                       "por-deu"
+                                       "por-eng"
+                                       "san-deu"
+                                       "slk-eng"
+                                       "slv-eng"
+                                       "spa-ast"
+                                       "spa-eng"
+                                       "spa-por"
+                                       "srp-eng"
+                                       "swe-eng"
+                                       "swh-eng"
+                                       "swh-pol"
+                                       "tur-deu"
+                                       "tur-eng"
+                                       "wol-fra")))
+
 (define %dicod-accounts
   (list (user-group
          (name "dicod")
-- 
2.46.0






Information forwarded to guix-patches <at> gnu.org:
bug#75063; Package guix-patches. (Tue, 24 Dec 2024 13:02:02 GMT) Full text and rfc822 format available.

Message #11 received at 75063 <at> debbugs.gnu.org (full text, mbox):

From: Runciter <runciter <at> whispers-vpn.org>
To: 75063 <at> debbugs.gnu.org
Cc: Runciter <runciter <at> whispers-vpn.org>
Subject: [PATCH 2/2] doc: add FreeDict dictionaries to dicod configuration
 example.
Date: Tue, 24 Dec 2024 13:00:55 +0000
* doc/guix.texi: (Dictionary Service): Update configuration example.

Signed-off-by: Runciter <runciter <at> whispers-vpn.org>
---
 doc/guix.texi | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 08ffbc36d7..1a394b91b2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41158,13 +41158,15 @@ Miscellaneous Services
                       (name "wordnet")
                       (module "wordnet")
                       (options
-                       (list #~(string-append "wnhome=" #$wordnet))))))
-          (databases (list
+                       (list #~(string-append "wnhome=" #$wordnet))))
+                       %dictorg-handler))
+          (databases (cons*
                       (dicod-database
                        (name "wordnet")
                        (complex? #t)
                        (handler "wordnet"))
-                      %dicod-database:gcide))))
+                      %dicod-database:gcide
+                      %freedict-dictorg-databases))))
 @end lisp
 
 @cindex Docker
-- 
2.46.0






Information forwarded to guix-patches <at> gnu.org:
bug#75063; Package guix-patches. (Wed, 25 Dec 2024 21:24:01 GMT) Full text and rfc822 format available.

Message #14 received at 75063 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Runciter <runciter <at> whispers-vpn.org>
Cc: 75063 <at> debbugs.gnu.org
Subject: Re: [bug#75063] [PATCH 1/2] gnu: dict: Add symbols to help users
 configure FreeDict with dicod.
Date: Wed, 25 Dec 2024 22:23:48 +0100
Hi,

Nice!  I recently added FreeDict dictionaries to my own config and was
contemplating the idea of having it properly integrated.  Perfect.  :-)

FWIW, I have:

--8<---------------cut here---------------start------------->8---
(define %freedict-databases
  (map (lambda (dictionary-name)
         (dicod-database
          (name "freedict")
          (handler "dictorg")
          (options
           (list #~(string-append "database="
                                  #$freedict-dictionaries
                                  "/share/dictd/" #$dictionary-name)))))
       '("fra-eng" "eng-fra" "eng-spa" "spa-eng")))
--8<---------------cut here---------------end--------------->8---

and then:

--8<---------------cut here---------------start------------->8---
     (service dicod-service-type
              (dicod-configuration
               (databases (cons %dicod-database:gcide
                                %freedict-databases))))
--8<---------------cut here---------------end--------------->8---

Runciter <runciter <at> whispers-vpn.org> skribis:

> * gnu/services/dict.scm: (%dictorg-handler): New variable;
> (freedict-dictorg-database): new procedure;
> (%freedict-dictorg-databases): new variable.
>
> Signed-off-by: Runciter <runciter <at> whispers-vpn.org>

[...]

> +(define %dictorg-handler
> +  (dicod-handler (name "dictorg")
> +                 (module "dictorg")
> +                 (options (list #~(string-append "dbdir=/")))))

I believe we don’t even need that; it’s built-in.

> +(define (freedict-dictorg-database dict-name)
> +  "Return a record of type @code{<dicod-database>} that configures a
> +database for the freedict multilingual dictionary named by the string
> +DICT-NAME."
> +  (dicod-database (name (string-append "freedict-"
> +                                       dict-name))
> +                  (complex? #t)

What does ‘complex?’ do actually?  (Seems to work without it.)

> * doc/guix.texi: (Dictionary Service): Update configuration example.

Could you squash both commits?  In general documentation goes to the
same commit as the change it documents.

> diff --git a/doc/guix.texi b/doc/guix.texi
> index 08ffbc36d7..1a394b91b2 100644
> --- a/doc/guix.texi
> +++ b/doc/guix.texi
> @@ -41158,13 +41158,15 @@ Miscellaneous Services
>                        (name "wordnet")
>                        (module "wordnet")
>                        (options
> -                       (list #~(string-append "wnhome=" #$wordnet))))))
> -          (databases (list
> +                       (list #~(string-append "wnhome=" #$wordnet))))
> +                       %dictorg-handler))
> +          (databases (cons*
>                        (dicod-database
>                         (name "wordnet")
>                         (complex? #t)
>                         (handler "wordnet"))
> -                      %dicod-database:gcide))))
> +                      %dicod-database:gcide
> +                      %freedict-dictorg-databases))))

Could you also document ‘freedict-dictorg-databases’ and
‘%freedict-dictorg-databases’, similar to how ‘%dicod-database:gcide’ is
documented?

For consistency, perhaps the these should be renamed to
‘dicod-freedict-databases’ and ‘%dicod-database:freedict’.

Thanks in advance,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#75063; Package guix-patches. (Thu, 26 Dec 2024 16:23:02 GMT) Full text and rfc822 format available.

Message #17 received at 75063 <at> debbugs.gnu.org (full text, mbox):

From: Runciter <runciter <at> whispers-vpn.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 75063 <at> debbugs.gnu.org
Subject: Re: [bug#75063] [PATCH 1/2] gnu: dict: Add symbols to help users
 configure FreeDict with dicod.
Date: Thu, 26 Dec 2024 16:22:12 +0000
Hello,

I'll squash both commits, simplify the configuration if appropriate,
update symbol names and improve the documentation in the beginning of
next week.

Meanwhile I have not tested much yet but by reviewing code I found
something which is possibly interesting.


>> +(define %dictorg-handler
>> +  (dicod-handler (name "dictorg")
>> +                 (module "dictorg")
>> +                 (options (list #~(string-append "dbdir=/")))))
>
> I believe we don’t even need that; it’s built-in.

You found something simpler but I'll need to dive into the dicod.conf
file in the store. See below.

And sorry for the call to string-append with just one argument, I also
seem to have included a useless G-exp... Probably a leftover from a
previous version of mine.

>> +(define (freedict-dictorg-database dict-name)
>> +  "Return a record of type @code{<dicod-database>} that configures a
>> +database for the freedict multilingual dictionary named by the string
>> +DICT-NAME."
>> +  (dicod-database (name (string-append "freedict-"
>> +                                       dict-name))
>> +                  (complex? #t)
>
> What does ‘complex?’ do actually?  (Seems to work without it.)

Reviewing the code in the (gnu services dict) module, the relevant
symbol is `database->text` defined inside the `dicod-configuration-file`
procedure.

`database->text` recurses into itself one time maximally, so that dicod
gets one auto-generated handler with default handler options from the
service module for each configured database which has `complex?`
evaluating to #f, independently (TBC) from what the system
configuration's explicit handlers and other non-complex databases are
configuring.

dicod has modules, handlers referencing a module, and databases
referencing a handler. The latter two are user-configurable. dicod has
hard-coded modules and I suppose it has no hard-coded handlers. In any
case, as far as the Guix service module design goes, dicod is always
supposed to get all of its handlers from Guix, either flexible handlers
from the system configuration, or default handlers from the service
module.

This being the inferred design intent, 3 things are possibly not ideal
in the way Guix handles dicod, by increasing order of importance:

1. In the Guix manual, the documentation of the `complex?` field may be
   slightly misleading. Strictly speaking it's the handler configuration
   which is complex when `complex?` is true, not the database
   configuration. Within dicod, those 2 levels of configuration are at
   least partially substitutable to each other, but they're not
   occupying the same position along an inheritance chain.

2. Here's one thing that I must experiment with before finishing this
   patch: some interactions between the service module and the system
   configuration might result in a "dirty" dicod configuration file
   defining the same handler multiple times. There are 2 cases which can
   result in this situation, and I don't think this is caught by the
   service module (TBC):
       a. same handler name defined explicitly by the system configuration,
          and by the service module when the system configuration also
          defines a non-complex database naming the same handler;
       b. System configuration containing multiple non-complex databases
          naming the same handler. If I have to bet right now, this is
          what happens with the simple system configuration you found.
          There's reason to think the dicod configuration file is "dirty"
          but non-failing, and in any case non-risky at run-time in this
          case, because the multiply-defined handler(s) should be all
          configured exactly to an identical default.

3. Are we possibly configuring dicod to load some of its modules
   multiple times, or possibly misleading users into doing it? This
   could be also non-failing but a most undesirable thing to do.

Regards,
Runciter





Information forwarded to guix-patches <at> gnu.org:
bug#75063; Package guix-patches. (Sun, 29 Dec 2024 18:36:01 GMT) Full text and rfc822 format available.

Message #20 received at 75063 <at> debbugs.gnu.org (full text, mbox):

From: Runciter <runciter <at> whispers-vpn.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 75063 <at> debbugs.gnu.org
Subject: Re: [bug#75063] [PATCH 1/2] gnu: dict: Add symbols to help users
 configure FreeDict with dicod.
Date: Sun, 29 Dec 2024 18:35:19 +0000
Hello Ludo,

I tested your config in a VM and it's not as bad as I thought. There's a
little problem though, which is one of those I anticipated: the
`load-module` statement of dicod.conf is uselessly repeated for each
non-complex dictorg database configured by the Guix service.

I have copied the dicod.conf that your configuration creates at the
bottom of this message. You can see the duplicates statements, 4 in your
case because you configured 4 non-complex dictorg dictionaries.

I'm going to go for symbols which create non-complex databases, like
your config. It's probably not going to be very easy to see if the
duplicate module loading in dicod causes a performance hit when one uses
a large number of dictorg databases, or all of them... Therefore, in the
info manual, I'm also going to change the configuration example into one
where only a handful of databases are registered into the service, as
opposed to all of them in my initial patch.

I'll send a revised patch later this week.

If that is deemed to be required, in order to fix the duplicate module
loading of dicod, one could always change the Scheme in the
`dicod-configuration-file` procedure.

Runciter

== BELOW THE dicod.conf CREATED WITH 4 NON-COMPLEX DICTORG DATABASES: ==
listen (localhost);

load-module gcide;
database {
   name "gcide";
   handler "gcide dbdir=/gnu/store/wsxc3jg8m2fi7qhlr2rrv4ik9vqhv6bp-gcide-0.53/share/gcide idxdir=/gnu/store/jflf8h70g61fsc4xgclasghjsmwqsa5c-dicod-gcide-index";
}

load-module dictorg;
database {
   name "freedict";
   handler "dictorg database=/gnu/store/nld9vc9f9jgk3x4hawjlnnzw8vzvavz2-freedict-dictionaries-0.0.0-0.914b5f7/share/dictd/fra-eng";
}

load-module dictorg;
database {
   name "freedict";
   handler "dictorg database=/gnu/store/nld9vc9f9jgk3x4hawjlnnzw8vzvavz2-freedict-dictionaries-0.0.0-0.914b5f7/share/dictd/eng-fra";
}

load-module dictorg;
database {
   name "freedict";
   handler "dictorg database=/gnu/store/nld9vc9f9jgk3x4hawjlnnzw8vzvavz2-freedict-dictionaries-0.0.0-0.914b5f7/share/dictd/eng-spa";
}

load-module dictorg;
database {
   name "freedict";
   handler "dictorg database=/gnu/store/nld9vc9f9jgk3x4hawjlnnzw8vzvavz2-freedict-dictionaries-0.0.0-0.914b5f7/share/dictd/spa-eng";
}





Information forwarded to guix-patches <at> gnu.org:
bug#75063; Package guix-patches. (Wed, 01 Jan 2025 19:24:02 GMT) Full text and rfc822 format available.

Message #23 received at 75063 <at> debbugs.gnu.org (full text, mbox):

From: Runciter <runciter <at> whispers-vpn.org>
To: 75063 <at> debbugs.gnu.org
Cc: Runciter <runciter <at> whispers-vpn.org>
Subject: [PATCH v2] gnu: dict: Add symbols to help users configure FreeDict
 with dicod.
Date: Wed, 01 Jan 2025 19:23:25 +0000
* gnu/services/dict.scm: (%dicod-database:freedict): New procedure;
(dicod-freedict-databases): new variable.
* doc/guix.texi: (Dictionary Service): Document them.

Signed-off-by: Runciter <runciter <at> whispers-vpn.org>
---
 doc/guix.texi         |  25 +++++++++--
 gnu/services/dict.scm | 100 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 121 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 08ffbc36d7..30ca842ea5 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41148,7 +41148,23 @@ Miscellaneous Services
 Dictionary of English using the @code{gcide} package.
 @end defvar
 
-The following is an example @code{dicod-service-type} configuration.
+@deffn {Procedure} %dicod-database:freedict dictionary-name
+"Returns a record of type @code{dicod-database} for purpose of configuring a
+database for the FreeDict multilingual dictionary named by the string
+@var{dictionary-name} into a service of type @code{dicod-service-type}."
+@end deffn
+
+@defvar dicod-freedict-databases
+A relatively large list of records of type @code{dicod-database}, made
+available for users who wish to configure all the FreeDict multilingual
+dictionaries provided by the @code{freedict-dictionaries} package into a
+service of type @code{dicod-service-type}.
+@end defvar
+
+The following is an example @code{dicod-service-type} configuration,
+extending a @command{dicod} daemon serving databases for the wordnet and
+gcide dictionaries, as well as a selection of FreeDict multilingual
+dictionaries.
 
 @lisp
 (service dicod-service-type
@@ -41159,12 +41175,15 @@ Miscellaneous Services
                       (module "wordnet")
                       (options
                        (list #~(string-append "wnhome=" #$wordnet))))))
-          (databases (list
+          (databases (cons*
                       (dicod-database
                        (name "wordnet")
                        (complex? #t)
                        (handler "wordnet"))
-                      %dicod-database:gcide))))
+                      %dicod-database:gcide
+                      (map
+                       %dicod-database:freedict
+                       '("fra-eng" "eng-fra" "eng-spa" "spa-eng"))))))
 @end lisp
 
 @cindex Docker
diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index a4e25f5302..69028ab5d3 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2016 Sou Bunnbu <iyzsong <at> gmail.com>
 ;;; Copyright © 2016, 2017, 2018, 2020, 2022, 2023 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2017 Huang Ying <huang.ying.caritas <at> gmail.com>
+;;; Copyright © 2024 Runciter <runciter <at> whispers-vpn.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -40,7 +41,9 @@ (define-module (gnu services dict)
             dicod-configuration
             dicod-handler
             dicod-database
-            %dicod-database:gcide))
+            %dicod-database:gcide
+            %dicod-database:freedict
+            dicod-freedict-databases))
 
 
 ;;;
@@ -94,6 +97,101 @@ (define %dicod-database:gcide
    (options (list #~(string-append "dbdir=" #$gcide "/share/gcide")
                   #~(string-append "idxdir=" #$%dicod-gcide-index)))))
 
+(define (%dicod-database:freedict dictionary-name)
+  "Returns a record of type @code{dicod-database} for purpose of configuring a
+database for the FreeDict multilingual dictionary named by the string
+@var{dictionary-name} into a service of type @code{dicod-service-type}."
+  (dicod-database (name (string-append "freedict-"
+                                       dictionary-name))
+                  (handler "dictorg")
+                  (options (list #~(string-append "database="
+                                                  #$freedict-dictionaries
+                                                  "/share/dictd/"
+                                                  #$dictionary-name)))))
+
+(define dicod-freedict-databases
+  (map %dicod-database:freedict (list "afr-deu"
+                                      "afr-eng"
+                                      "ara-eng"
+                                      "bre-fra"
+                                      "ces-eng"
+                                      "ckb-kmr"
+                                      "cym-eng"
+                                      "dan-eng"
+                                      "deu-ita"
+                                      "deu-kur"
+                                      "deu-nld"
+                                      "deu-por"
+                                      "deu-tur"
+                                      "eng-afr"
+                                      "eng-ara"
+                                      "eng-ces"
+                                      "eng-cym"
+                                      "eng-dan"
+                                      "eng-ell"
+                                      "eng-fra"
+                                      "eng-gle"
+                                      "eng-hin"
+                                      "eng-hrv"
+                                      "eng-hun"
+                                      "eng-ita"
+                                      "eng-lat"
+                                      "eng-lit"
+                                      "eng-nld"
+                                      "eng-pol"
+                                      "eng-por"
+                                      "eng-rom"
+                                      "eng-rus"
+                                      "eng-spa"
+                                      "eng-srp"
+                                      "eng-swh"
+                                      "eng-tur"
+                                      "fra-bre"
+                                      "fra-eng"
+                                      "fra-nld"
+                                      "gla-deu"
+                                      "gle-eng"
+                                      "gle-pol"
+                                      "hrv-eng"
+                                      "hun-eng"
+                                      "isl-eng"
+                                      "ita-deu"
+                                      "ita-eng"
+                                      "jpn-deu"
+                                      "jpn-eng"
+                                      "jpn-fra"
+                                      "jpn-rus"
+                                      "kha-deu"
+                                      "kha-eng"
+                                      "kur-deu"
+                                      "kur-eng"
+                                      "kur-tur"
+                                      "lat-deu"
+                                      "lat-eng"
+                                      "lit-eng"
+                                      "mkd-bul"
+                                      "nld-deu"
+                                      "nld-eng"
+                                      "nld-fra"
+                                      "nno-nob"
+                                      "oci-cat"
+                                      "pol-gle"
+                                      "por-deu"
+                                      "por-eng"
+                                      "san-deu"
+                                      "slk-eng"
+                                      "slv-eng"
+                                      "spa-ast"
+                                      "spa-eng"
+                                      "spa-por"
+                                      "srp-eng"
+                                      "swe-eng"
+                                      "swh-eng"
+                                      "swh-pol"
+                                      "tur-deu"
+                                      "tur-eng"
+                                      "wol-fra")))
+
 (define %dicod-accounts
   (list (user-group
          (name "dicod")

base-commit: 9dc91360fd2e41fb783ab4af341ac60aee2f5d31
-- 
2.47.1






Information forwarded to guix-patches <at> gnu.org:
bug#75063; Package guix-patches. (Wed, 08 Jan 2025 22:16:02 GMT) Full text and rfc822 format available.

Message #26 received at 75063 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Runciter <runciter <at> whispers-vpn.org>
Cc: 75063 <at> debbugs.gnu.org
Subject: Re: [bug#75063] [PATCH v2] gnu: dict: Add symbols to help users
 configure FreeDict with dicod.
Date: Wed, 08 Jan 2025 23:15:33 +0100
Hi,

Runciter <runciter <at> whispers-vpn.org> skribis:

> * gnu/services/dict.scm: (%dicod-database:freedict): New procedure;
> (dicod-freedict-databases): new variable.
> * doc/guix.texi: (Dictionary Service): Document them.
>
> Signed-off-by: Runciter <runciter <at> whispers-vpn.org>

[...]

> -The following is an example @code{dicod-service-type} configuration.
> +@deffn {Procedure} %dicod-database:freedict dictionary-name
> +"Returns a record of type @code{dicod-database} for purpose of configuring a
> +database for the FreeDict multilingual dictionary named by the string
> +@var{dictionary-name} into a service of type @code{dicod-service-type}."
> +@end deffn

Could you remove double quotes?

I would add an example, like so: “… named by @var{dictionary-name}, a
string such as @code{"kur-eng"} for the Kurdish-to-English dictionary,
into a service …”.

> +@defvar dicod-freedict-databases
> +A relatively large list of records of type @code{dicod-database}, made

Oops, I guess my message was unclear.

I think the procedure should be called ‘dicod-freedict-database’
(singular); the variable for all the databases should be called
‘%dicod-databases:freedict’ (similar to ‘%dicod-database:gcide’).

Apart from that it looks good to me.

Could you send one last version along these lines?

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#75063; Package guix-patches. (Thu, 09 Jan 2025 14:14:03 GMT) Full text and rfc822 format available.

Message #29 received at 75063 <at> debbugs.gnu.org (full text, mbox):

From: Runciter <runciter <at> whispers-vpn.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 75063 <at> debbugs.gnu.org
Subject: Re: [bug#75063] [PATCH v2] gnu: dict: Add symbols to help users
 configure FreeDict with dicod.
Date: Thu, 09 Jan 2025 14:13:08 +0000
Hello Ludo,

OK, just finished a revised patch with these corrections and sending
now.

Regards,
Runciter





Information forwarded to guix-patches <at> gnu.org:
bug#75063; Package guix-patches. (Thu, 09 Jan 2025 14:15:02 GMT) Full text and rfc822 format available.

Message #32 received at 75063 <at> debbugs.gnu.org (full text, mbox):

From: Runciter <runciter <at> whispers-vpn.org>
To: 75063 <at> debbugs.gnu.org
Cc: Runciter <runciter <at> whispers-vpn.org>
Subject: [PATCH v3] gnu: dict: Add symbols to help users configure FreeDict
 with dicod.
Date: Thu, 09 Jan 2025 14:14:31 +0000
* gnu/services/dict.scm: (dicod-freedict-database): New procedure;
(%dicod-databases:freedict): new variable.
* doc/guix.texi: (Dictionary Service): Document them.

Signed-off-by: Runciter <runciter <at> whispers-vpn.org>
---
 doc/guix.texi         |  27 ++++++++++--
 gnu/services/dict.scm | 100 +++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 123 insertions(+), 4 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 08ffbc36d7..8552c102d7 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -41148,7 +41148,25 @@ Miscellaneous Services
 Dictionary of English using the @code{gcide} package.
 @end defvar
 
-The following is an example @code{dicod-service-type} configuration.
+@deffn {Procedure} dicod-freedict-database dictionary-name
+Returns a record of type @code{dicod-database} for purpose of
+configuring a database for the FreeDict multilingual dictionary named by
+@var{dictionary-name}, a string such as @code{"kur-eng"} for the
+Kurdish-to-English dictionary, into a service of type
+@code{dicod-service-type}.
+@end deffn
+
+@defvar %dicod-databases:freedict
+A relatively large list of records of type @code{dicod-database}, made
+available for users who wish to configure all the FreeDict multilingual
+dictionaries provided by the @code{freedict-dictionaries} package into a
+service of type @code{dicod-service-type}.
+@end defvar
+
+The following is an example @code{dicod-service-type} configuration,
+extending a @command{dicod} daemon serving databases for the wordnet and
+gcide dictionaries, as well as a selection of FreeDict multilingual
+dictionaries.
 
 @lisp
 (service dicod-service-type
@@ -41159,12 +41177,15 @@ Miscellaneous Services
                       (module "wordnet")
                       (options
                        (list #~(string-append "wnhome=" #$wordnet))))))
-          (databases (list
+          (databases (cons*
                       (dicod-database
                        (name "wordnet")
                        (complex? #t)
                        (handler "wordnet"))
-                      %dicod-database:gcide))))
+                      %dicod-database:gcide
+                      (map
+                       dicod-freedict-database
+                       '("fra-eng" "eng-fra" "eng-spa" "spa-eng"))))))
 @end lisp
 
 @cindex Docker
diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index a4e25f5302..fef8915439 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2016 Sou Bunnbu <iyzsong <at> gmail.com>
 ;;; Copyright © 2016, 2017, 2018, 2020, 2022, 2023 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2017 Huang Ying <huang.ying.caritas <at> gmail.com>
+;;; Copyright © 2024 Runciter <runciter <at> whispers-vpn.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -40,7 +41,9 @@ (define-module (gnu services dict)
             dicod-configuration
             dicod-handler
             dicod-database
-            %dicod-database:gcide))
+            %dicod-database:gcide
+            dicod-freedict-database
+            %dicod-databases:freedict))
 
 
 ;;;
@@ -94,6 +97,101 @@ (define %dicod-database:gcide
    (options (list #~(string-append "dbdir=" #$gcide "/share/gcide")
                   #~(string-append "idxdir=" #$%dicod-gcide-index)))))
 
+(define (dicod-freedict-database dictionary-name)
+  "Returns a record of type @code{dicod-database} for purpose of configuring a
+database for the FreeDict multilingual dictionary named by the string
+@var{dictionary-name} into a service of type @code{dicod-service-type}."
+  (dicod-database (name (string-append "freedict-"
+                                       dictionary-name))
+                  (handler "dictorg")
+                  (options (list #~(string-append "database="
+                                                  #$freedict-dictionaries
+                                                  "/share/dictd/"
+                                                  #$dictionary-name)))))
+
+(define %dicod-databases:freedict
+  (map dicod-freedict-database (list "afr-deu"
+                                     "afr-eng"
+                                     "ara-eng"
+                                     "bre-fra"
+                                     "ces-eng"
+                                     "ckb-kmr"
+                                     "cym-eng"
+                                     "dan-eng"
+                                     "deu-ita"
+                                     "deu-kur"
+                                     "deu-nld"
+                                     "deu-por"
+                                     "deu-tur"
+                                     "eng-afr"
+                                     "eng-ara"
+                                     "eng-ces"
+                                     "eng-cym"
+                                     "eng-dan"
+                                     "eng-ell"
+                                     "eng-fra"
+                                     "eng-gle"
+                                     "eng-hin"
+                                     "eng-hrv"
+                                     "eng-hun"
+                                     "eng-ita"
+                                     "eng-lat"
+                                     "eng-lit"
+                                     "eng-nld"
+                                     "eng-pol"
+                                     "eng-por"
+                                     "eng-rom"
+                                     "eng-rus"
+                                     "eng-spa"
+                                     "eng-srp"
+                                     "eng-swh"
+                                     "eng-tur"
+                                     "fra-bre"
+                                     "fra-eng"
+                                     "fra-nld"
+                                     "gla-deu"
+                                     "gle-eng"
+                                     "gle-pol"
+                                     "hrv-eng"
+                                     "hun-eng"
+                                     "isl-eng"
+                                     "ita-deu"
+                                     "ita-eng"
+                                     "jpn-deu"
+                                     "jpn-eng"
+                                     "jpn-fra"
+                                     "jpn-rus"
+                                     "kha-deu"
+                                     "kha-eng"
+                                     "kur-deu"
+                                     "kur-eng"
+                                     "kur-tur"
+                                     "lat-deu"
+                                     "lat-eng"
+                                     "lit-eng"
+                                     "mkd-bul"
+                                     "nld-deu"
+                                     "nld-eng"
+                                     "nld-fra"
+                                     "nno-nob"
+                                     "oci-cat"
+                                     "pol-gle"
+                                     "por-deu"
+                                     "por-eng"
+                                     "san-deu"
+                                     "slk-eng"
+                                     "slv-eng"
+                                     "spa-ast"
+                                     "spa-eng"
+                                     "spa-por"
+                                     "srp-eng"
+                                     "swe-eng"
+                                     "swh-eng"
+                                     "swh-pol"
+                                     "tur-deu"
+                                     "tur-eng"
+                                     "wol-fra")))
+
 (define %dicod-accounts
   (list (user-group
          (name "dicod")

base-commit: 9dc91360fd2e41fb783ab4af341ac60aee2f5d31
-- 
2.47.1






Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Sun, 26 Jan 2025 21:07:01 GMT) Full text and rfc822 format available.

Notification sent to Runciter <runciter <at> whispers-vpn.org>:
bug acknowledged by developer. (Sun, 26 Jan 2025 21:07:02 GMT) Full text and rfc822 format available.

Message #37 received at 75063-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Runciter <runciter <at> whispers-vpn.org>
Cc: 75063-done <at> debbugs.gnu.org
Subject: Re: [bug#75063] [PATCH v3] gnu: dict: Add symbols to help users
 configure FreeDict with dicod.
Date: Sun, 26 Jan 2025 22:05:50 +0100
Runciter <runciter <at> whispers-vpn.org> skribis:

> * gnu/services/dict.scm: (dicod-freedict-database): New procedure;
> (%dicod-databases:freedict): new variable.
> * doc/guix.texi: (Dictionary Service): Document them.
>
> Signed-off-by: Runciter <runciter <at> whispers-vpn.org>

Applied, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 24 Feb 2025 12:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 17 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.