2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, callPackage
|
|
|
|
, pythonOlder
|
|
|
|
, fetchFromGitHub
|
|
|
|
, Babel
|
|
|
|
, gruut-ipa
|
2022-01-03 16:56:52 +00:00
|
|
|
, dateparser
|
2021-07-14 22:03:04 +00:00
|
|
|
, jsonlines
|
|
|
|
, num2words
|
|
|
|
, python-crfsuite
|
|
|
|
, dataclasses
|
|
|
|
, python
|
2022-01-03 16:56:52 +00:00
|
|
|
, networkx
|
|
|
|
, glibcLocales
|
|
|
|
, pytestCheckHook
|
2021-07-14 22:03:04 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
langPkgs = [
|
|
|
|
"cs"
|
|
|
|
"de"
|
|
|
|
"es"
|
2022-01-03 16:56:52 +00:00
|
|
|
"en"
|
2021-07-14 22:03:04 +00:00
|
|
|
"fr"
|
|
|
|
"it"
|
|
|
|
"nl"
|
|
|
|
"pt"
|
|
|
|
"ru"
|
|
|
|
"sv"
|
|
|
|
"sw"
|
|
|
|
];
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "gruut";
|
2022-01-03 16:56:52 +00:00
|
|
|
version = "2.2.0";
|
2021-07-14 22:03:04 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rhasspy";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-01-03 16:56:52 +00:00
|
|
|
sha256 = "sha256-9vj3x2IjTso8ksN1cqe5frwg0Y3GhOB6bPWvaBSBOf8=";
|
2021-07-14 22:03:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace requirements.txt \
|
2022-01-03 16:56:52 +00:00
|
|
|
--replace "Babel~=2.8.0" "Babel" \
|
|
|
|
--replace "dateparser~=1.0.0" "dateparser" \
|
|
|
|
--replace "gruut_lang_en~=2.0.0" "gruut_lang_en"
|
2021-07-14 22:03:04 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
Babel
|
|
|
|
gruut-ipa
|
|
|
|
jsonlines
|
|
|
|
num2words
|
|
|
|
python-crfsuite
|
2022-01-03 16:56:52 +00:00
|
|
|
dateparser
|
|
|
|
networkx
|
2021-07-14 22:03:04 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.7") [
|
|
|
|
dataclasses
|
|
|
|
] ++ (map (lang: callPackage ./language-pack.nix {
|
|
|
|
inherit lang version format src;
|
|
|
|
}) langPkgs);
|
|
|
|
|
2022-01-03 16:56:52 +00:00
|
|
|
checkInputs = [ glibcLocales pytestCheckHook ];
|
|
|
|
|
|
|
|
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";
|
|
|
|
homepage = "https://github.com/rhasspy/gruut";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = teams.tts.members;
|
|
|
|
};
|
|
|
|
}
|