1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 setuptools,
7
8 nltk,
9 numpy,
10 pint,
11 python-crfsuite,
12
13 pytestCheckHook,
14 nltk-data,
15}:
16buildPythonPackage rec {
17 pname = "ingredient-parser-nlp";
18 version = "2.3.0";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "strangetom";
23 repo = "ingredient-parser";
24 tag = version;
25 hash = "sha256-+Hd+NtInG3umo0unCQHw8rBDhuIM55VtkVXiD1tKNVo=";
26 };
27
28 build-system = [ setuptools ];
29
30 dependencies = [
31 nltk
32 numpy
33 pint
34 python-crfsuite
35 ];
36
37 nativeCheckInputs = [
38 pytestCheckHook
39 ];
40
41 pythonImportsCheck = [
42 "ingredient_parser"
43 ];
44
45 # Needed for tests
46 preCheck = ''
47 export NLTK_DATA=${nltk-data.averaged-perceptron-tagger-eng}
48 '';
49
50 meta = {
51 description = "Parse structured information from recipe ingredient sentences";
52 license = lib.licenses.mit;
53 homepage = "https://github.com/strangetom/ingredient-parser/";
54 changelog = "https://github.com/strangetom/ingredient-parser/releases/tag/${src.tag}";
55 maintainers = with lib.maintainers; [ antonmosich ];
56 };
57}