2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, callPackage
|
|
|
|
, fetchFromGitHub
|
2022-05-18 14:49:53 +00:00
|
|
|
, babel
|
2021-07-14 22:03:04 +00:00
|
|
|
, gruut-ipa
|
2022-01-03 16:56:52 +00:00
|
|
|
, dateparser
|
2021-07-14 22:03:04 +00:00
|
|
|
, jsonlines
|
|
|
|
, num2words
|
|
|
|
, python-crfsuite
|
|
|
|
, python
|
2022-01-03 16:56:52 +00:00
|
|
|
, networkx
|
|
|
|
, glibcLocales
|
|
|
|
, pytestCheckHook
|
2021-07-14 22:03:04 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
langPkgs = [
|
2022-02-10 20:34:41 +00:00
|
|
|
"ar"
|
2021-07-14 22:03:04 +00:00
|
|
|
"cs"
|
|
|
|
"de"
|
2022-01-03 16:56:52 +00:00
|
|
|
"en"
|
2022-02-10 20:34:41 +00:00
|
|
|
"es"
|
|
|
|
"fa"
|
2021-07-14 22:03:04 +00:00
|
|
|
"fr"
|
|
|
|
"it"
|
2022-02-10 20:34:41 +00:00
|
|
|
"lb"
|
2021-07-14 22:03:04 +00:00
|
|
|
"nl"
|
|
|
|
"pt"
|
|
|
|
"ru"
|
|
|
|
"sv"
|
|
|
|
"sw"
|
|
|
|
];
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "gruut";
|
2022-08-12 12:06:08 +00:00
|
|
|
version = "2.3.4";
|
2021-07-14 22:03:04 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rhasspy";
|
|
|
|
repo = pname;
|
2022-08-12 12:06:08 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-DD7gnvH9T2R6E19+exWE7Si+XEpfh0Iy5FYbycjgzgM=";
|
2021-07-14 22:03:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace requirements.txt \
|
2022-02-10 20:34:41 +00:00
|
|
|
--replace "gruut_lang_en~=2.0.0" "gruut_lang_en" \
|
2023-03-15 16:39:30 +00:00
|
|
|
--replace "jsonlines~=1.2.0" "jsonlines" \
|
|
|
|
--replace "networkx>=2.5.0,<3.0.0" "networkx"
|
2021-07-14 22:03:04 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2022-05-18 14:49:53 +00:00
|
|
|
babel
|
2021-07-14 22:03:04 +00:00
|
|
|
gruut-ipa
|
|
|
|
jsonlines
|
|
|
|
num2words
|
|
|
|
python-crfsuite
|
2022-01-03 16:56:52 +00:00
|
|
|
dateparser
|
|
|
|
networkx
|
2021-07-14 22:03:04 +00:00
|
|
|
] ++ (map (lang: callPackage ./language-pack.nix {
|
|
|
|
inherit lang version format src;
|
|
|
|
}) langPkgs);
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ glibcLocales pytestCheckHook ];
|
2022-01-03 16:56:52 +00:00
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# https://github.com/rhasspy/gruut/issues/25
|
|
|
|
"test_lexicon_external"
|
|
|
|
|
|
|
|
# requires mishkal library
|
|
|
|
"test_fa"
|
|
|
|
"test_ar"
|
|
|
|
"test_lb"
|
|
|
|
];
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export LC_ALL=en_US.utf-8
|
2021-07-14 22:03:04 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"gruut"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A tokenizer, text cleaner, and phonemizer for many human languages";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "gruut";
|
2021-07-14 22:03:04 +00:00
|
|
|
homepage = "https://github.com/rhasspy/gruut";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = teams.tts.members;
|
|
|
|
};
|
|
|
|
}
|