2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, callPackage
|
|
|
|
, pythonOlder
|
|
|
|
, 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
|
|
|
|
, dataclasses
|
|
|
|
, 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}";
|
|
|
|
sha256 = "sha256-DD7gnvH9T2R6E19+exWE7Si+XEpfh0Iy5FYbycjgzgM=";
|
2021-07-14 22:03:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace requirements.txt \
|
2022-01-03 16:56:52 +00:00
|
|
|
--replace "dateparser~=1.0.0" "dateparser" \
|
2022-02-10 20:34:41 +00:00
|
|
|
--replace "gruut_lang_en~=2.0.0" "gruut_lang_en" \
|
|
|
|
--replace "jsonlines~=1.2.0" "jsonlines"
|
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
|
|
|
] ++ 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;
|
|
|
|
};
|
|
|
|
}
|