2021-01-24 00:29:22 +00:00
|
|
|
{ lib, buildPythonPackage, fetchurl, jieba, pkuseg, spacy }:
|
2017-09-13 18:32:46 +01:00
|
|
|
let
|
pythonPackages.spacy_models: add more models
This change adds the missing language-specific spaCy models:
da_core_news_lg, da_core_news_md, da_core_news_sm, de_core_news_lg,
el_core_news_lg, es_core_news_lg, fr_core_news_lg, it_core_news_lg,
it_core_news_md, lt_core_news_lg, lt_core_news_md, nb_core_news_lg,
nb_core_news_md, nl_core_news_lg, nl_core_news_md, pl_core_news_lg,
pl_core_news_md, pl_core_news_sm, pt_core_news_lg, pt_core_news_md,
ro_core_news_sm, ro_core_news_md, ro_core_news_lg, zh_core_web_lg,
zh_core_web_md, zh_core_web_sm
I also checked the licenses and fixed them where necessary.
2020-06-21 10:50:21 +01:00
|
|
|
buildModelPackage = { pname, version, sha256, license }:
|
|
|
|
let
|
|
|
|
lang = builtins.substring 0 2 pname;
|
|
|
|
in buildPythonPackage {
|
2017-09-13 18:32:46 +01:00
|
|
|
inherit pname version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/explosion/spacy-models/releases/download/${pname}-${version}/${pname}-${version}.tar.gz";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
|
pythonPackages.spacy_models: add more models
This change adds the missing language-specific spaCy models:
da_core_news_lg, da_core_news_md, da_core_news_sm, de_core_news_lg,
el_core_news_lg, es_core_news_lg, fr_core_news_lg, it_core_news_lg,
it_core_news_md, lt_core_news_lg, lt_core_news_md, nb_core_news_lg,
nb_core_news_md, nl_core_news_lg, nl_core_news_md, pl_core_news_lg,
pl_core_news_md, pl_core_news_sm, pt_core_news_lg, pt_core_news_md,
ro_core_news_sm, ro_core_news_md, ro_core_news_lg, zh_core_web_lg,
zh_core_web_md, zh_core_web_sm
I also checked the licenses and fixed them where necessary.
2020-06-21 10:50:21 +01:00
|
|
|
propagatedBuildInputs = [ spacy ]
|
|
|
|
++ lib.optionals (lang == "zh") [ jieba pkuseg ];
|
2017-09-13 18:32:46 +01:00
|
|
|
|
2020-08-18 18:32:01 +01:00
|
|
|
pythonImportsCheck = [ pname ];
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2017-09-13 18:32:46 +01:00
|
|
|
description = "Models for the spaCy NLP library";
|
|
|
|
homepage = "https://github.com/explosion/spacy-models";
|
2019-08-13 22:52:01 +01:00
|
|
|
license = licenses.${license};
|
2017-09-13 18:32:46 +01:00
|
|
|
maintainers = with maintainers; [ rvl ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-24 00:29:22 +00:00
|
|
|
makeModelSet = models: with lib; listToAttrs (map (m: nameValuePair m.pname (buildModelPackage m)) models);
|
2017-09-13 18:32:46 +01:00
|
|
|
|
2021-01-24 00:29:22 +00:00
|
|
|
in makeModelSet (lib.importJSON ./models.json)
|
2017-09-13 18:32:46 +01:00
|
|
|
|
|
|
|
# cat models.json | jq -r '.[] | @uri "https://github.com/explosion/spacy-models/releases/download/\(.pname)-\(.version)/\(.pname)-\(.version).tar.gz"' | xargs -n1 nix-prefetch-url
|