2018-03-25 19:29:37 +01:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, regex
|
|
|
|
, langcodes
|
|
|
|
, ftfy
|
|
|
|
, msgpack
|
|
|
|
, mecab-python3
|
|
|
|
, jieba
|
2018-09-13 17:16:34 +01:00
|
|
|
, pytest
|
2018-03-25 19:29:37 +01:00
|
|
|
, pythonOlder
|
|
|
|
, fetchFromGitHub
|
|
|
|
}:
|
|
|
|
|
2020-05-03 19:10:27 +01:00
|
|
|
buildPythonPackage rec {
|
2018-03-25 19:29:37 +01:00
|
|
|
pname = "wordfreq";
|
2020-05-03 19:10:27 +01:00
|
|
|
version = "2.3.2";
|
|
|
|
disabled = pythonOlder "3";
|
2018-03-25 19:29:37 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "LuminosoInsight";
|
|
|
|
repo = "wordfreq";
|
2018-09-13 17:16:34 +01:00
|
|
|
# upstream don't tag by version
|
2020-05-03 19:10:27 +01:00
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "078657iiksrqzcc2wvwhiilf3xxq5vlinsv0kz03qzqr1qyvbmas";
|
2018-03-25 19:29:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ regex langcodes ftfy msgpack mecab-python3 jieba ];
|
2020-05-03 19:10:27 +01:00
|
|
|
|
2018-03-25 19:29:37 +01:00
|
|
|
# patch to relax version requirements for regex
|
|
|
|
# dependency to prevent break in upgrade
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py --replace "regex ==" "regex >="
|
|
|
|
'';
|
2020-05-03 19:10:27 +01:00
|
|
|
|
|
|
|
checkInputs = [ pytest ];
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
# These languages require additional dictionaries
|
|
|
|
pytest tests -k 'not test_japanese and not test_korean and not test_languages and not test_french_and_related'
|
|
|
|
'';
|
2018-03-25 19:29:37 +01:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A library for looking up the frequencies of words in many languages, based on many sources of data";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/LuminosoInsight/wordfreq/";
|
2018-03-25 19:29:37 +01:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ ixxie ];
|
|
|
|
};
|
|
|
|
}
|