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