1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
{
lib,
buildPythonPackage,
fetchFromGitHub,
cacert,
faster-whisper,
flac,
google-cloud-speech,
groq,
httpx,
openai-whisper,
openai,
pocketsphinx,
pyaudio,
pytestCheckHook,
requests,
respx,
setuptools,
soundfile,
standard-aifc,
typing-extensions,
}:
buildPythonPackage rec {
pname = "speechrecognition";
version = "3.14.3";
pyproject = true;
src = fetchFromGitHub {
owner = "Uberi";
repo = "speech_recognition";
tag = version;
hash = "sha256-g//KKxPRe1pWVJo7GsRNIV59r0J7XJEoXvH0tGuV3Jk=";
};
postPatch = ''
# Remove Bundled binaries
rm speech_recognition/flac-*
rm -r third-party
substituteInPlace speech_recognition/audio.py \
--replace-fail 'shutil_which("flac")' '"${lib.getExe flac}"'
'';
build-system = [ setuptools ];
dependencies = [
standard-aifc
typing-extensions
];
optional-dependencies = {
assemblyai = [ requests ];
audio = [ pyaudio ];
faster-whisper = [ faster-whisper ];
google-cloud = [ google-cloud-speech ];
groq = [
groq
httpx
];
openai = [
httpx
openai
];
pocketsphinx = [ pocketsphinx ];
whisper-local = [
openai-whisper
soundfile
];
};
nativeCheckInputs = [
groq
pytestCheckHook
pocketsphinx
respx
]
++ lib.concatAttrValues optional-dependencies;
pythonImportsCheck = [ "speech_recognition" ];
disabledTests = [
# Parsed string does not match expected
"test_sphinx_keywords"
];
meta = {
description = "Speech recognition module for Python, supporting several engines and APIs, online and offline";
homepage = "https://github.com/Uberi/speech_recognition";
changelog = "https://github.com/Uberi/speech_recognition/releases/tag/${src.tag}";
license = with lib.licenses; [
gpl2Only
bsd3
];
maintainers = with lib.maintainers; [ fab ];
};
}
|