1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 poetry-core,
8
9 # dependencies
10 boltons,
11 gensim,
12 gitpython,
13 greek-accentuation,
14 nltk,
15 pyyaml,
16 rapidfuzz,
17 requests,
18 scikit-learn,
19 scipy,
20 spacy,
21 stanza,
22 torch,
23 tqdm,
24
25 # tests
26 pytestCheckHook,
27 writableTmpDirAsHomeHook,
28}:
29buildPythonPackage rec {
30 pname = "cltk";
31 version = "1.5.0";
32 pyproject = true;
33
34 src = fetchFromGitHub {
35 owner = "cltk";
36 repo = "cltk";
37 tag = "v${version}";
38 hash = "sha256-aeWbfDVNn6DwW+KFh62n5RBgWp5uSWDv2RHmB27/xI4=";
39 };
40
41 postPatch = ''
42 substituteInPlace pyproject.toml \
43 --replace-fail "poetry>=1.1.13" poetry-core \
44 --replace-fail "poetry.masonry.api" "poetry.core.masonry.api" \
45 --replace-fail 'scipy = "<1.13.0"' 'scipy = "^1"' \
46 --replace-fail 'boltons = "^21.0.0"' 'boltons = "^24.0.0"'
47 '';
48
49 build-system = [ poetry-core ];
50
51 pythonRelaxDeps = [
52 "spacy"
53 ];
54
55 dependencies = [
56 boltons
57 gensim
58 gitpython
59 greek-accentuation
60 nltk
61 pyyaml
62 rapidfuzz
63 requests
64 scikit-learn
65 scipy
66 spacy
67 stanza
68 torch
69 tqdm
70 ];
71
72 nativeCheckInputs = [
73 pytestCheckHook
74 writableTmpDirAsHomeHook
75 ];
76
77 # Most of tests fail as they require local files to be present and also internet access
78 doCheck = false;
79
80 meta = {
81 description = "Natural language processing (NLP) framework for pre-modern languages";
82 homepage = "https://cltk.org";
83 changelog = "https://github.com/cltk/cltk/releases/tag/v${version}";
84 license = lib.licenses.mit;
85 maintainers = with lib.maintainers; [ kmein ];
86 };
87}