diff --git a/pkgs/development/python-modules/gruut-ipa/default.nix b/pkgs/development/python-modules/gruut-ipa/default.nix new file mode 100644 index 000000000000..67930bcd0341 --- /dev/null +++ b/pkgs/development/python-modules/gruut-ipa/default.nix @@ -0,0 +1,47 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pkgs +, python +}: + +buildPythonPackage rec { + pname = "gruut-ipa"; + version = "0.9.2"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "rhasspy"; + repo = pname; + rev = "df74f7dff562d868ad8088b7251f9e7206271d37"; + sha256 = "0b2znvjngffxc0mlmqmcai8l22ff09kc39bj6f0lkjw735vclnzh"; + }; + + postPatch = '' + patchShebangs bin/speak-ipa + substituteInPlace bin/speak-ipa \ + --replace '${"\${src_dir}:"}' "$out/lib/${python.libPrefix}/site-packages:" \ + --replace "do espeak" "do ${pkgs.espeak}/bin/espeak" + ''; + + postInstall = '' + install -m0755 bin/speak-ipa $out/bin/speak-ipa + ''; + + checkPhase = '' + runHook preCheck + ${python.interpreter} -m unittest discover + runHook postCheck + ''; + + pythonImportsCheck = [ + "gruut_ipa" + ]; + + meta = with lib; { + description = "Library for manipulating pronunciations using the International Phonetic Alphabet (IPA)"; + homepage = "https://github.com/rhasspy/gruut-ipa"; + license = licenses.mit; + maintainers = teams.tts.members; + }; +} diff --git a/pkgs/development/python-modules/gruut/default.nix b/pkgs/development/python-modules/gruut/default.nix new file mode 100644 index 000000000000..c922d0b52d49 --- /dev/null +++ b/pkgs/development/python-modules/gruut/default.nix @@ -0,0 +1,74 @@ +{ lib +, buildPythonPackage +, callPackage +, pythonOlder +, fetchFromGitHub +, Babel +, gruut-ipa +, jsonlines +, num2words +, python-crfsuite +, dataclasses +, python +}: + +let + langPkgs = [ + "cs" + "de" + "es" + "fr" + "it" + "nl" + "pt" + "ru" + "sv" + "sw" + ]; +in +buildPythonPackage rec { + pname = "gruut"; + version = "1.2.0"; + format = "setuptools"; + + src = fetchFromGitHub { + owner = "rhasspy"; + repo = pname; + rev = "v${version}"; + sha256 = "1763qmcd1gxap27jppqaywx03k5cagcl62z2p2qdiqigdksplm2g"; + }; + + postPatch = '' + substituteInPlace requirements.txt \ + --replace "Babel~=2.8.0" "Babel" + ''; + + propagatedBuildInputs = [ + Babel + gruut-ipa + jsonlines + num2words + python-crfsuite + ] ++ lib.optionals (pythonOlder "3.7") [ + dataclasses + ] ++ (map (lang: callPackage ./language-pack.nix { + inherit lang version format src; + }) langPkgs); + + checkPhase = '' + runHook preCheck + ${python.interpreter} -m unittest discover + runHook postCheck + ''; + + pythonImportsCheck = [ + "gruut" + ]; + + meta = with lib; { + description = "A tokenizer, text cleaner, and phonemizer for many human languages"; + homepage = "https://github.com/rhasspy/gruut"; + license = licenses.mit; + maintainers = teams.tts.members; + }; +} diff --git a/pkgs/development/python-modules/gruut/language-pack.nix b/pkgs/development/python-modules/gruut/language-pack.nix new file mode 100644 index 000000000000..2d3cfa9cc518 --- /dev/null +++ b/pkgs/development/python-modules/gruut/language-pack.nix @@ -0,0 +1,30 @@ +{ lib +, buildPythonPackage + +, lang +, version +, format +, src +}: + +buildPythonPackage rec { + pname = "gruut-lang-${lang}"; + inherit version format src; + + prePatch = '' + cd "${pname}" + ''; + + pythonImportsCheck = [ + "gruut_lang_${lang}" + ]; + + doCheck = false; + + meta = with lib; { + description = "Language files for gruut tokenizer/phonemizer"; + homepage = "https://github.com/rhasspy/gruut"; + license = licenses.mit; + maintainers = teams.tts.members; + }; +} diff --git a/pkgs/development/python-modules/python-crfsuite/default.nix b/pkgs/development/python-modules/python-crfsuite/default.nix new file mode 100644 index 000000000000..cd2adc48c6fa --- /dev/null +++ b/pkgs/development/python-modules/python-crfsuite/default.nix @@ -0,0 +1,36 @@ +{ lib +, buildPythonPackage +, fetchPypi +, pytestCheckHook +}: + +buildPythonPackage rec { + pname = "python-crfsuite"; + version = "0.9.7"; + format = "setuptools"; + + src = fetchPypi { + inherit pname version; + sha256 = "1ryfcdfpqbrf8rcd2rlay2gfiba3px3q508543jf81shrv93hi9v"; + }; + + preCheck = '' + # make sure import the built version, not the source one + rm -r pycrfsuite + ''; + + checkInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ + "pycrfsuite" + ]; + + meta = with lib; { + description = "Python binding for CRFsuite"; + homepage = "https://github.com/scrapinghub/python-crfsuite"; + license = licenses.mit; + maintainers = teams.tts.members; + }; +} diff --git a/pkgs/tools/audio/tts/default.nix b/pkgs/tools/audio/tts/default.nix index 0e57e19a2883..d80ad9b0dc09 100644 --- a/pkgs/tools/audio/tts/default.nix +++ b/pkgs/tools/audio/tts/default.nix @@ -12,25 +12,24 @@ # # If you upgrade from an old version you may have to delete old models from ~/.local/share/tts # Also note that your tts version might not support all available models so check: -# https://github.com/coqui-ai/TTS/releases/tag/v0.0.15.1 +# https://github.com/coqui-ai/TTS/releases/tag/v0.1.2 # # For now, for deployment check the systemd unit in the pull request: # https://github.com/NixOS/nixpkgs/pull/103851#issue-521121136 python3Packages.buildPythonApplication rec { pname = "tts"; - version = "0.0.15.1"; + version = "0.1.2"; src = fetchFromGitHub { owner = "coqui-ai"; repo = "TTS"; rev = "v${version}"; - sha256 = "0z6sbzspgmw5ja8r2zysyhdk4jzlv88a0ihkvxvvwxslkyncdb89"; + sha256 = "1qgiaqn7iqxyf54qgnpmli69nw9s3gmi9qv874jsgycykc10hjg4"; }; postPatch = '' sed -i -e 's!librosa==[^"]*!librosa!' requirements.txt - sed -i -e 's!unidecode==[^"]*!unidecode!' requirements.txt sed -i -e 's!numba==[^"]*!numba!' requirements.txt sed -i -e 's!numpy==[^"]*!numpy!' requirements.txt sed -i -e 's!umap-learn==[^"]*!umap-learn!' requirements.txt @@ -44,6 +43,7 @@ python3Packages.buildPythonApplication rec { anyascii coqpit flask + gruut gdown inflect jieba diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6d6b95e8f4a3..ac525f720f28 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5562,6 +5562,10 @@ in stdenv = stdenv_32bit; }; + gruut = with python3.pkgs; toPythonApplication gruut; + + gruut-ipa = with python3.pkgs; toPythonApplication gruut-ipa; + gx = callPackage ../tools/package-management/gx { }; gx-go = callPackage ../tools/package-management/gx/go { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 2e61983ead98..26b8b45cc5db 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3131,6 +3131,10 @@ in { grpcio-tools = callPackage ../development/python-modules/grpcio-tools { }; + gruut = callPackage ../development/python-modules/gruut { }; + + gruut-ipa = callPackage ../development/python-modules/gruut-ipa { }; + gsd = callPackage ../development/python-modules/gsd { }; gspread = callPackage ../development/python-modules/gspread { }; @@ -5377,6 +5381,8 @@ in { python-codon-tables = callPackage ../development/python-modules/python-codon-tables { }; + python-crfsuite = callPackage ../development/python-modules/python-crfsuite { }; + python-csxcad = callPackage ../development/python-modules/python-csxcad { }; python-ecobee-api = callPackage ../development/python-modules/python-ecobee-api { };