Unverified Commit 6cc09019 authored by OTABI Tomoya's avatar OTABI Tomoya Committed by GitHub
Browse files

Merge pull request #307542 from ViZiD/attacut

python312Packages.attacut: init at 1.1.0-dev
parents 03b825b6 b7f4262d
Loading
Loading
Loading
Loading
+73 −0
Original line number Diff line number Diff line
{
  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";
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -931,6 +931,8 @@ self: super: with self; {
  atsim-potentials = callPackage ../development/python-modules/atsim-potentials { };
  attacut = callPackage ../development/python-modules/attacut { };
  attrdict = callPackage ../development/python-modules/attrdict { };
  attrs = callPackage ../development/python-modules/attrs { };