1{ lib
2, buildPythonPackage
3, regex
4, langcodes
5, ftfy
6, msgpack
7, mecab-python3
8, jieba
9, nose
10, pythonOlder
11, fetchFromGitHub
12}:
13
14buildPythonPackage rec {
15 pname = "wordfreq";
16 version = "2.0";
17
18 src = fetchFromGitHub {
19 owner = "LuminosoInsight";
20 repo = "wordfreq";
21 rev = "e3a1b470d9f8e0d82e9f179ffc41abba434b823b";
22 sha256 = "1wjkhhj7nxfnrghwvmvwc672s30lp4b7yr98gxdxgqcq6wdshxwv";
23 };
24
25 checkInputs = [ nose ];
26
27 checkPhase = ''
28 # These languages require additional dictionaries
29 nosetests -e test_japanese -e test_korean -e test_languages
30 '';
31
32 propagatedBuildInputs = [ regex langcodes ftfy msgpack mecab-python3 jieba ];
33
34 # patch to relax version requirements for regex
35 # dependency to prevent break in upgrade
36 postPatch = ''
37 substituteInPlace setup.py --replace "regex ==" "regex >="
38 '';
39
40 disabled = pythonOlder "3";
41
42 meta = with lib; {
43 description = "A library for looking up the frequencies of words in many languages, based on many sources of data";
44 homepage = https://github.com/LuminosoInsight/wordfreq/;
45 license = licenses.mit;
46 maintainers = with maintainers; [ ixxie ];
47 };
48}