all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Graves via Guix-patches via <guix-patches@gnu.org>
To: 58140@debbugs.gnu.org
Cc: ngraves@ngraves.fr
Subject: [bug#58140] [PATCH v3 3/6] gnu: Add vosk-api.
Date: Thu, 29 Sep 2022 11:00:19 +0200	[thread overview]
Message-ID: <20220929090022.5950-3-ngraves@ngraves.fr> (raw)
In-Reply-To: <20220929090022.5950-1-ngraves@ngraves.fr>

* gnu/packages/machine-learning.scm (vosk-api): New variable.
---
 gnu/packages/machine-learning.scm | 80 ++++++++++++++++++++++++++++++-
 1 file changed, 78 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index b444352337..b5e17462eb 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1615,8 +1615,7 @@ (define kaldi-for-vosk
           (base32 "04xw2dpfvpla8skpk08azmgr9k97cd8hn83lj4l85q165gbzql4s"))))
       (inputs
        (list alsa-lib
-             ;; `(,gfortran "lib") ;; replaced by lapack
-             lapack
+             lapack ;; compared to base kaldi, replacing `(,gfortran "lib")
              glib
              gstreamer
              jack-1
@@ -3486,3 +3485,80 @@ (define-public python-pyro-ppl
      "This package provides a Python library for probabilistic modeling and
 inference.")
     (license license:asl2.0)))
+
+(define-public vosk-api
+  (let* ((openfst openfst-for-vosk)
+         (kaldi kaldi-for-vosk))
+    (package
+      (name "vosk-api")
+      (version "0.3.43")
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/alphacep/vosk-api")
+               (commit (string-append "v" version))))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0xmp8i140c2hd3rj9dap8a2rnsvzb1k9hnqm12xzbaxrw73rkc29"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:tests? #f
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'chdir
+              (lambda _ (chdir "src")))
+            (replace 'configure
+              (lambda _
+                (let* ((lapack   #$(this-package-input "lapack"))
+                       (openfst  #$(this-package-input "openfst"))
+                       (openblas #$(this-package-input "openblas"))
+                       (kaldi    #$(this-package-input "kaldi")))
+                  (substitute* "./Makefile"
+                    (("USE_SHARED\\?=0")
+                     "USE_SHARED?=1")
+                    (("-DFST_NO_DYNAMIC_LINKING")
+                     "")
+                    (("-lopenblas -llapack -lblas -lf2c")
+                     (string-append
+                      "-L" openblas "/lib " "-lopenblas "
+                      "-L" lapack "/lib " "-llapack -lblas "))
+                    (("-lfst -lfstngram")
+                     (string-append
+                      "-L" openfst "/lib " "-lfst -lfstngram "))
+                    (("\\$\\(HOME\\)\\/travis\\/kaldi")
+                     (string-append kaldi "/include"))
+                    (("\\$\\(KALDI_ROOT\\)\\/tools\\/openfst")
+                     openfst)
+                    (("\\$\\(KALDI_ROOT\\)\\/tools\\/OpenBLAS\\/install")
+                     openblas)
+                    (("\\$\\(KALDI_ROOT\\)\\/libs")
+                     (string-append kaldi "/lib"))))))
+            (replace 'install
+              (lambda _
+                (let* ((lib (string-append #$output "/lib"))
+                       (src (string-append #$output "/src")))
+                  (mkdir-p lib)
+                  (mkdir-p src)
+                  (install-file "libvosk.so" lib)
+                  (for-each
+                   (lambda (x) (install-file x src))
+                   (find-files "." "\\.h$"))))))))
+      (inputs (list kaldi openfst lapack openblas))
+      (home-page "https://alphacephei.com/vosk")
+      (synopsis "Speech recognition toolkit based on @code{kaldi}")
+      (description "\
+This package provides a speech recognition toolkit based on @code{kaldi}.  It
+supports more than 20 languages and dialects - English, Indian English,
+German, French, Spanish, Portuguese, Chinese, Russian, Turkish, Vietnamese,
+Italian, Dutch, Catalan, Arabic, Greek, Farsi, Filipino, Ukrainian, Kazakh,
+Swedish, Japanese, Esperanto, Hindi, Czech, Polish. The program works offline,
+even on lightweight devices.  Portable per-language models are about 50Mb each,
+and there are much bigger and precise models available.
+
+Vosk API provides a streaming API allowing to use it `on-the-fly' and bindings
+for different programming languages.  It allows quick reconfiguration of
+vocabulary for better accuracy, and supports speaker identification beside
+simple speech recognition.")
+      (license license:asl2.0))))
-- 
2.37.3





  parent reply	other threads:[~2022-09-29  9:08 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 11:34 [bug#58140] Simple offline text-to-speech incoming ! Nicolas Graves via Guix-patches via
2022-09-28 11:57 ` [bug#58140] [PATCH 1/6] gnu: Add openfst-for-vosk Nicolas Graves via Guix-patches via
2022-09-28 11:57   ` [bug#58140] [PATCH 2/6] gnu: Add kaldi-for-vosk Nicolas Graves via Guix-patches via
2022-09-28 21:05     ` Maxime Devos
2022-09-29  6:44       ` ( via Guix-patches via
2022-09-29  8:20       ` Nicolas Graves via Guix-patches via
2022-09-29  9:32         ` Maxime Devos
2022-09-28 11:57   ` [bug#58140] [PATCH 3/6] gnu: Add vosk-api Nicolas Graves via Guix-patches via
2022-09-28 11:57   ` [bug#58140] [PATCH 4/6] gnu: Add python-vosk Nicolas Graves via Guix-patches via
2022-09-28 11:57   ` [bug#58140] [PATCH 5/6] gnu: Add python-nerd-dictation Nicolas Graves via Guix-patches via
2022-09-28 11:57   ` [bug#58140] [PATCH 6/6] gnu: Add python-nerd-dictation/wayland Nicolas Graves via Guix-patches via
2022-09-28 17:58 ` [bug#58140] Simple offline text-to-speech incoming ! Denis 'GNUtoo' Carikli
2022-09-28 20:07   ` Nicolas Graves via Guix-patches via
2022-09-28 21:30 ` [bug#58140] [PATCH 6/6 v2] gnu: Add python-nerd-dictation/wayland Nicolas Graves via Guix-patches via
2022-09-28 21:39   ` Maxime Devos
2022-09-29  9:00 ` [bug#58140] [PATCH v3 1/6] gnu: Add openfst-for-vosk Nicolas Graves via Guix-patches via
2022-09-29  9:00   ` [bug#58140] [PATCH v3 2/6] gnu: Add kaldi-for-vosk Nicolas Graves via Guix-patches via
2022-09-29  9:00   ` Nicolas Graves via Guix-patches via [this message]
2022-09-29  9:00   ` [bug#58140] [PATCH v3 4/6] gnu: Add python-vosk Nicolas Graves via Guix-patches via
2022-09-29  9:00   ` [bug#58140] [PATCH v3 5/6] gnu: Add python-nerd-dictation Nicolas Graves via Guix-patches via
2022-09-29  9:00   ` [bug#58140] [PATCH v3 6/6] gnu: Add python-nerd-dictation/wayland Nicolas Graves via Guix-patches via
2022-09-29  9:02 ` [bug#58140] [PATCH v4 1/2] gnu: Add nerd-dictation Nicolas Graves via Guix-patches via
2022-09-29  9:02   ` [bug#58140] [PATCH v4 2/2] gnu: Add nerd-dictation/wayland Nicolas Graves via Guix-patches via
2022-10-17  8:46     ` bug#58140: Simple offline text-to-speech incoming ! Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220929090022.5950-3-ngraves@ngraves.fr \
    --to=guix-patches@gnu.org \
    --cc=58140@debbugs.gnu.org \
    --cc=ngraves@ngraves.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.