1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6
7 setuptools,
8
9 pytestCheckHook,
10
11 docopt,
12 fire,
13 numpy,
14 python-crfsuite,
15 pyyaml,
16 six,
17 ssg,
18 torch,
19}:
20
21buildPythonPackage rec {
22 pname = "attacut";
23 version = "1.1.0-dev";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "PyThaiNLP";
28 repo = "attacut";
29 tag = "v${version}";
30 hash = "sha256-x3JJC1Xd+tsOAHJEHGzIrhIrNGSvLSanAFc7+uXb2Kk=";
31 };
32
33 # no more need, see patch...
34 postPatch = ''
35 sed -i "/nptyping>=/d" setup.py
36 '';
37
38 patches = [
39 (fetchpatch {
40 name = "fix-nptyping-deprecated-array.patch";
41 url = "https://github.com/PyThaiNLP/attacut/commit/a707297b3f08a015d32d8ac241aa8cb11128cbd4.patch";
42 includes = [ "attacut/evaluation.py" ];
43 hash = "sha256-k2DJPwiH1Fyf5u6+zavx0bankCXsJVZrw1MGcf8ZL+M=";
44 })
45 ];
46
47 build-system = [ setuptools ];
48
49 dependencies = [
50 docopt
51 fire
52 numpy
53 python-crfsuite
54 pyyaml
55 six
56 ssg
57 torch
58 ];
59
60 nativeCheckInputs = [ pytestCheckHook ];
61
62 enabledTestPaths = [ "tests/*" ];
63
64 pythonImportsCheck = [ "attacut" ];
65
66 meta = with lib; {
67 description = "Fast and Accurate Neural Thai Word Segmenter";
68 homepage = "https://github.com/PyThaiNLP/attacut";
69 license = licenses.mit;
70 maintainers = with maintainers; [ vizid ];
71 mainProgram = "attacut-cli";
72 };
73}