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 stringcase,
23 torch,
24 tqdm,
25
26 # tests
27 pytestCheckHook,
28}:
29buildPythonPackage rec {
30 pname = "cltk";
31 version = "1.3.0";
32
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "cltk";
37 repo = "cltk";
38 rev = "refs/tags/v${version}";
39 hash = "sha256-/rdv96lnSGN+aJJmPSIan79zoXxnStokFEAjBtCLKy4=";
40 };
41
42 postPatch = ''
43 substituteInPlace pyproject.toml \
44 --replace-fail "poetry>=1.1.13" poetry-core \
45 --replace-fail "poetry.masonry.api" "poetry.core.masonry.api" \
46 --replace-fail 'scipy = "<1.13.0"' 'scipy = "^1"' \
47 --replace-fail 'boltons = "^21.0.0"' 'boltons = "^24.0.0"'
48 '';
49
50 build-system = [ poetry-core ];
51
52 pythonRelaxDeps = [
53 "spacy"
54 ];
55
56 dependencies = [
57 boltons
58 gensim
59 gitpython
60 greek-accentuation
61 nltk
62 pyyaml
63 rapidfuzz
64 requests
65 scikit-learn
66 scipy
67 spacy
68 stanza
69 stringcase
70 torch
71 tqdm
72 ];
73
74 nativeCheckInputs = [
75 pytestCheckHook
76 ];
77
78 preCheck = ''
79 export HOME=$(mktemp -d)
80 '';
81
82 # Most of tests fail as they require local files to be present and also internet access
83 doCheck = false;
84
85 meta = {
86 description = "Natural language processing (NLP) framework for pre-modern languages";
87 homepage = "https://cltk.org";
88 changelog = "https://github.com/cltk/cltk/releases/tag/v${version}";
89 license = lib.licenses.mit;
90 maintainers = with lib.maintainers; [ kmein ];
91 };
92}