summary refs log tree commit diff
path: root/pkgs/development/python-modules/word2vec/default.nix
blob: b078231c942987a43024bb4812372d2464482f98 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ lib
, buildPythonPackage
, fetchPypi
, fetchzip
, cython
, numpy
, scikit-learn
, six
, setuptools-scm
, gcc
, pytest
, pytestcov
, isPy27
}:
let
  testData = fetchzip {
    url = "http://mattmahoney.net/dc/text8.zip";
    sha256 = "0w3l64bww9znmmvd9cqbfmh3dddnlrjicz43y5qq6fhi9cfqjfar";
  };
in
buildPythonPackage rec {
  pname = "word2vec";
  version = "0.11.1";
  disabled = isPy27;

  src = fetchPypi {
    inherit pname version;
    sha256 = "222d8ffb47f385c43eba45e3f308e605fc9736b2b7137d74979adf1a31e7c8b4";
  };

  nativeBuildInputs = [ setuptools-scm gcc ];

  propagatedBuildInputs = [ cython numpy scikit-learn six ];

  checkInputs = [ pytest pytestcov ];

  # Checks require test data downloaded separately
  # See project source Makefile:test-data rule for reference
  checkPhase = ''
    PATH=$PATH:$out/bin
    mkdir data
    head -c 100000 ${testData}/text8 > data/text8-small
    pytest
  '';

  meta = with lib; {
    description = "Tool for computing continuous distributed representations of words";
    homepage = "https://github.com/danielfrg/word2vec";
    license = licenses.asl20;
    maintainers = with maintainers; [ NikolaMandic ];
  };

}