base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12 (#356361)
[NixPkgs.git] / pkgs / tools / text / nltk-data / default.nix
blob56ec586cc397749a342a53174a8687010844178f
1 { lib, newScope, fetchFromGitHub, unzip, stdenvNoCC }:
2 let
3   base = {
4     version = "0-unstable-2024-07-29";
5     nativeBuildInputs = [ unzip ];
6     dontBuild = true;
7     meta = with lib; {
8       description = "NLTK Data";
9       homepage = "https://github.com/nltk/nltk_data";
10       license = licenses.asl20;
11       platforms = platforms.all;
12       maintainers = with maintainers; [ happysalada ];
13     };
14   };
15   makeNltkDataPackage = {pname, location, hash}:
16     let
17       src = fetchFromGitHub {
18         owner = "nltk";
19         repo = "nltk_data";
20         rev = "cfe82914f3c2d24363687f1db3b05e8b9f687e2b";
21         inherit hash;
22         sparseCheckout = [ "packages/${location}/${pname}.zip" ];
23       };
24     in
25     stdenvNoCC.mkDerivation (base // {
26       inherit pname src;
27       inherit (base) version;
28       installPhase = ''
29         runHook preInstall
31         mkdir -p $out
32         unzip ${src}/packages/${location}/${pname}.zip
33         mkdir -p $out/${location}
34         cp -R ${pname}/ $out/${location}
36         runHook postInstall
37       '';
38     });
40 lib.makeScope newScope (self: {
41   punkt = makeNltkDataPackage {
42     pname = "punkt";
43     location = "tokenizers";
44     hash = "sha256-OzMkruoYbFKqzuimOXIpE5lhHz8tmSqOFoLT+fjdTVg=";
45   };
46   punkt_tab = makeNltkDataPackage {
47     pname = "punkt_tab";
48     location = "tokenizers";
49     hash = "sha256-OzMkruoYbFKqzuimOXIpE5lhHz8tmSqOFoLT+fjdTVg=";
50   };
51   averaged_perceptron_tagger = makeNltkDataPackage {
52     pname = "averaged_perceptron_tagger";
53     location = "taggers";
54     hash = "sha256-tl3Cn2okhBkUtTXvAmFRx72Brez6iTGRdmFTwFmpk3M=";
55   };
56   snowball_data = makeNltkDataPackage {
57     pname = "snowball_data";
58     location = "stemmers";
59     hash = "sha256-mNefwOPVJGz9kXV3LV4DuV7FJpNir/Nwg4ujd0CogEk=";
60   };
61   stopwords = makeNltkDataPackage {
62     pname = "stopwords";
63     location = "corpora";
64     hash = "sha256-8lMjW5YI8h6dHJ/83HVY2OYGDyKPpgkUAKPISiAKqqk=";
65   };
66   wordnet = makeNltkDataPackage {
67     pname = "wordnet";
68     location = "corpora";
69     hash = "sha256-8lMjW5YI8h6dHJ/83HVY2OYGDyKPpgkUAKPISiAKqqk=";
70   };