nixpkgs-suyu/pkgs/development/python-modules/gruut/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

97 lines
1.7 KiB
Nix
Raw Normal View History

2021-07-03 21:30:55 +02:00
{ lib
, buildPythonPackage
, callPackage
, pythonOlder
, fetchFromGitHub
, babel
2021-07-03 21:30:55 +02:00
, gruut-ipa
2021-12-31 12:06:07 +01:00
, dateparser
2021-07-03 21:30:55 +02:00
, jsonlines
, num2words
, python-crfsuite
, dataclasses
, python
2021-12-31 12:06:07 +01:00
, networkx
, glibcLocales
, pytestCheckHook
2021-07-03 21:30:55 +02:00
}:
let
langPkgs = [
"ar"
2021-07-03 21:30:55 +02:00
"cs"
"de"
2021-12-31 12:06:07 +01:00
"en"
"es"
"fa"
2021-07-03 21:30:55 +02:00
"fr"
"it"
"lb"
2021-07-03 21:30:55 +02:00
"nl"
"pt"
"ru"
"sv"
"sw"
];
in
buildPythonPackage rec {
pname = "gruut";
2022-03-19 10:38:00 +01:00
version = "2.2.3";
2021-07-03 21:30:55 +02:00
format = "setuptools";
src = fetchFromGitHub {
owner = "rhasspy";
repo = pname;
rev = "v${version}";
2022-03-19 10:38:00 +01:00
sha256 = "sha256-B5fPUW4YaMzDDXxncfrWwxGdUizuaxnPImNMf1ZZJ/I=";
2021-07-03 21:30:55 +02:00
};
postPatch = ''
substituteInPlace requirements.txt \
2021-12-31 12:06:07 +01:00
--replace "dateparser~=1.0.0" "dateparser" \
2022-01-20 23:17:55 +01:00
--replace "gruut_lang_en~=2.0.0" "gruut_lang_en" \
--replace "jsonlines~=1.2.0" "jsonlines"
2021-07-03 21:30:55 +02:00
'';
propagatedBuildInputs = [
babel
2021-07-03 21:30:55 +02:00
gruut-ipa
jsonlines
num2words
python-crfsuite
2021-12-31 12:06:07 +01:00
dateparser
networkx
2021-07-03 21:30:55 +02:00
] ++ lib.optionals (pythonOlder "3.7") [
dataclasses
] ++ (map (lang: callPackage ./language-pack.nix {
inherit lang version format src;
}) langPkgs);
2021-12-31 12:06:07 +01: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-03 21:30:55 +02: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;
};
}