2018-10-29 21:17:56 +00:00
|
|
|
{ stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
2020-09-17 02:29:28 +01:00
|
|
|
, fetchzip
|
2018-10-29 21:17:56 +00:00
|
|
|
, cython
|
|
|
|
, numpy
|
2019-11-17 18:49:59 +00:00
|
|
|
, scikitlearn
|
|
|
|
, six
|
2020-09-17 02:29:28 +01:00
|
|
|
, setuptools_scm
|
|
|
|
, gcc
|
|
|
|
, pytest
|
|
|
|
, pytestcov
|
2019-11-17 18:49:59 +00:00
|
|
|
, isPy27
|
2018-10-29 21:17:56 +00:00
|
|
|
}:
|
2020-09-17 02:29:28 +01:00
|
|
|
let
|
|
|
|
testData = fetchzip {
|
|
|
|
url = "http://mattmahoney.net/dc/text8.zip";
|
|
|
|
sha256 = "0w3l64bww9znmmvd9cqbfmh3dddnlrjicz43y5qq6fhi9cfqjfar";
|
|
|
|
};
|
|
|
|
in
|
2018-10-29 21:17:56 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "word2vec";
|
2020-06-06 07:47:37 +01:00
|
|
|
version = "0.11.1";
|
2019-11-17 18:49:59 +00:00
|
|
|
disabled = isPy27;
|
2018-10-29 21:17:56 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2020-06-06 07:47:37 +01:00
|
|
|
sha256 = "222d8ffb47f385c43eba45e3f308e605fc9736b2b7137d74979adf1a31e7c8b4";
|
2018-10-29 21:17:56 +00:00
|
|
|
};
|
|
|
|
|
2020-09-17 02:29:28 +01:00
|
|
|
nativeBuildInputs = [ setuptools_scm gcc ];
|
|
|
|
|
2019-11-17 18:49:59 +00:00
|
|
|
propagatedBuildInputs = [ cython numpy scikitlearn six ];
|
2018-10-29 21:17:56 +00:00
|
|
|
|
2020-09-17 02:29:28 +01:00
|
|
|
checkInputs = [ pytest pytestcov ];
|
|
|
|
|
|
|
|
# Checks require test data downloaded separately
|
|
|
|
# See project source Makefile:test-data rule for reference
|
2018-10-29 21:17:56 +00:00
|
|
|
checkPhase = ''
|
2020-09-17 02:29:28 +01:00
|
|
|
PATH=$PATH:$out/bin
|
|
|
|
mkdir data
|
|
|
|
head -c 100000 ${testData}/text8 > data/text8-small
|
|
|
|
pytest
|
2018-10-29 21:17:56 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Tool for computing continuous distributed representations of words";
|
|
|
|
homepage = "https://github.com/danielfrg/word2vec";
|
2020-09-17 02:29:28 +01:00
|
|
|
license = licenses.asl20;
|
2018-10-29 21:17:56 +00:00
|
|
|
maintainers = with maintainers; [ NikolaMandic ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|