about summary refs log tree commit diff
path: root/pkgs/development/python-modules/attacut/default.nix
blob: 70e8a98ccfd452ce24672aecab1ca462e3aa8364 (plain) (blame)
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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  fetchpatch,

  setuptools,

  pytestCheckHook,

  docopt,
  fire,
  numpy,
  python-crfsuite,
  pyyaml,
  six,
  ssg,
  torch,
}:

buildPythonPackage rec {
  pname = "attacut";
  version = "1.1.0-dev";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "PyThaiNLP";
    repo = "attacut";
    rev = "refs/tags/v${version}";
    hash = "sha256-x3JJC1Xd+tsOAHJEHGzIrhIrNGSvLSanAFc7+uXb2Kk=";
  };

  # no more need, see patch...
  postPatch = ''
    sed -i "/nptyping>=/d" setup.py
  '';

  patches = [
    (fetchpatch {
      name = "fix-nptyping-deprecated-array.patch";
      url = "https://github.com/PyThaiNLP/attacut/commit/a707297b3f08a015d32d8ac241aa8cb11128cbd4.patch";
      includes = [ "attacut/evaluation.py" ];
      hash = "sha256-k2DJPwiH1Fyf5u6+zavx0bankCXsJVZrw1MGcf8ZL+M=";
    })
  ];

  build-system = [ setuptools ];

  dependencies = [
    docopt
    fire
    numpy
    python-crfsuite
    pyyaml
    six
    ssg
    torch
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  pytestFlagsArray = [ "tests/*" ];

  pythonImportsCheck = [ "attacut" ];

  meta = with lib; {
    description = "A Fast and Accurate Neural Thai Word Segmenter";
    homepage = "https://github.com/PyThaiNLP/attacut";
    license = licenses.mit;
    maintainers = with maintainers; [ vizid ];
    mainProgram = "attacut-cli";
  };
}