repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
poincare_glove | poincare_glove-master/gensim/test/test_ldamodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import numbers
im... | 20,474 | 38.83463 | 114 | py |
poincare_glove | poincare_glove-master/gensim/test/test_api.py | import logging
import unittest
import os
import gensim.downloader as api
from gensim.downloader import base_dir
import shutil
import numpy as np
@unittest.skipIf(
os.environ.get("SKIP_NETWORK_TESTS", False) == "1",
"Skip network-related tests (probably SSL problems on this CI/OS)"
)
class TestApi(unittest.Tes... | 3,371 | 41.15 | 106 | py |
poincare_glove | poincare_glove-master/gensim/test/test_hdpmodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
from gensim.corpo... | 1,679 | 29 | 96 | py |
poincare_glove | poincare_glove-master/gensim/test/test_summarization.py | #!/usr/bin/env python
# encoding: utf-8
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated test to reproduce the results of Mihalcea and Tarau (2004).
Mihalcea and Tarau (2004) introduces the TextRank summarization algorithm.
As a validation of the gensim implementation we repr... | 7,447 | 37.590674 | 97 | py |
poincare_glove | poincare_glove-master/gensim/test/test_datatype.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking various matutils functions.
"""
import logging
import unittest
import numpy as np
from gensim.test.utils import datapath
from gensim.models.keyedvectors import ... | 1,944 | 34.363636 | 97 | py |
poincare_glove | poincare_glove-master/gensim/test/test_rpmodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import numpy as n... | 2,349 | 35.153846 | 118 | py |
poincare_glove | poincare_glove-master/gensim/test/test_keywords.py | #!/usr/bin/env python
# encoding: utf-8
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated test to reproduce the results of Mihalcea and Tarau (2004).
Mihalcea and Tarau (2004) introduces the TextRank summarization algorithm.
As a validation of the gensim implementation we repr... | 3,889 | 37.137255 | 116 | py |
poincare_glove | poincare_glove-master/gensim/test/test_tfidfmodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import numpy as n... | 12,442 | 41.906897 | 114 | py |
poincare_glove | poincare_glove-master/gensim/test/test_sklearn_api.py | import unittest
import numpy
import codecs
import pickle
from scipy import sparse
try:
from sklearn.pipeline import Pipeline
from sklearn import linear_model, cluster
from sklearn.exceptions import NotFittedError
except ImportError:
raise unittest.SkipTest("Test requires scikit-learn to be installed, w... | 60,933 | 49.027915 | 120 | py |
poincare_glove | poincare_glove-master/gensim/test/test_parsing.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Automated tests for the parsing module.
"""
import logging
import unittest
import numpy as np
from gensim.parsing.preprocessing import \
remove_stopwords, strip_punctuation2, strip_tags, strip_short, strip_numeric, strip_non_alphanum, \
strip_multiple_whitespa... | 2,925 | 34.682927 | 103 | py |
poincare_glove | poincare_glove-master/gensim/test/test_probability_estimation.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for probability estimation algorithms in the probability_estimation module.
"""
import logging
import unittest
fro... | 3,547 | 33.784314 | 93 | py |
poincare_glove | poincare_glove-master/gensim/test/test_fasttext.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import unittest
import os
import struct
import numpy as np
from gensim import utils
from gensim.models.word2vec import LineSentence
from gensim.models.fasttext import FastText as FT_gensim
from gensim.models.wrappers.fasttext import FastTextKeyedVectors
fr... | 28,353 | 44.439103 | 120 | py |
poincare_glove | poincare_glove-master/gensim/test/test_BM25.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
from gensim.summar... | 1,829 | 34.882353 | 100 | py |
poincare_glove | poincare_glove-master/gensim/test/test_word2vec.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import os
import b... | 43,941 | 45.996791 | 119 | py |
poincare_glove | poincare_glove-master/gensim/test/test_matutils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
import logging
import unittest
import numpy as np
from scipy.special import psi # gamma function utils
import gensim.matutils as matu... | 4,523 | 29.77551 | 111 | py |
poincare_glove | poincare_glove-master/gensim/test/test_lee.py | #!/usr/bin/env python
# encoding: utf-8
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated test to reproduce the results of Lee et al. (2005)
Lee et al. (2005) compares different models for semantic
similarity and verifies the results with similarity judgements from humans.
As... | 4,277 | 36.526316 | 97 | py |
poincare_glove | poincare_glove-master/gensim/test/svd_error.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
"""USAGE: %(program)s MATRIX.mm [CLIP_DOCS] [CLIP_TERMS]
Check truncated SVD error for the algo in gensim, using a given corpus. This script
runs the decomposition with several internal parameters (number of r... | 7,398 | 36.94359 | 118 | py |
poincare_glove | poincare_glove-master/gensim/test/test_dtm.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Automated tests for DTM/DIM model
"""
import logging
from subprocess import CalledProcessError
import gensim
import os
import unittest
from gensim import corpora
from gensim.test.utils import datapath
class TestDtmModel(unittest.TestCase):
def setUp(self):
... | 2,535 | 34.71831 | 96 | py |
poincare_glove | poincare_glove-master/gensim/test/utils.py | #!/usr/bin/env python
# encoding: utf-8
"""Module contains common utilities used in automated code tests for Gensim modules.
Attributes:
-----------
module_path : str
Full path to this module directory.
common_texts : list of list of str
Toy dataset.
common_dictionary : :class:`~gensim.corpora.dictionary.Di... | 5,596 | 27.850515 | 108 | py |
poincare_glove | poincare_glove-master/gensim/test/test_miislita.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
This module replicates the miislita vector spaces from
"A Linear Algebra Approach to the Vector Space Model -- A Fast Track Tutorial"
by Dr. E. Garcia, admin@miislita.com
See http://www.miisl... | 3,661 | 32.59633 | 107 | py |
poincare_glove | poincare_glove-master/gensim/test/test_ldamallet_wrapper.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import os
import o... | 6,810 | 40.785276 | 115 | py |
poincare_glove | poincare_glove-master/gensim/test/test_text_analysis.py | import logging
import unittest
from gensim.corpora.dictionary import Dictionary
from gensim.topic_coherence.text_analysis import (
InvertedIndexAccumulator, WordOccurrenceAccumulator, ParallelWordOccurrenceAccumulator,
CorpusAccumulator)
from gensim.test.utils import common_texts
class BaseTestCases(object):... | 6,482 | 37.820359 | 100 | py |
poincare_glove | poincare_glove-master/gensim/test/simspeed2.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
USAGE: %(program)s CORPUS_DENSE.mm CORPUS_SPARSE.mm [NUMDOCS]
Run speed test of similarity queries. Only use the first NUMDOCS d... | 6,415 | 39.1 | 113 | py |
poincare_glove | poincare_glove-master/gensim/test/test_indirect_confirmation.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for indirect confirmation measures in the indirect_confirmation_measure module.
"""
import logging
import unittest
... | 2,906 | 37.76 | 104 | py |
poincare_glove | poincare_glove-master/gensim/test/test_coherencemodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import os
import unittest
from unit... | 15,457 | 41.350685 | 111 | py |
poincare_glove | poincare_glove-master/gensim/test/test_ldavowpalwabbit_wrapper.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Tests for Vowpal Wabbit LDA wrapper.
Will not be run unless the environment variable 'VOWPAL_WABBIT_PATH' is set
and points to the ... | 7,796 | 35.097222 | 110 | py |
poincare_glove | poincare_glove-master/gensim/test/test_corpora_hashdictionary.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Unit tests for the `corpora.HashDictionary` class.
"""
import logging
import unittest
import os
import zlib
from gensim.corpora.hashdictionary import HashDictionary
from gensim.test.utils i... | 6,552 | 35.608939 | 91 | py |
poincare_glove | poincare_glove-master/gensim/test/test_wordrank_wrapper.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import os
import ... | 2,854 | 33.817073 | 108 | py |
poincare_glove | poincare_glove-master/gensim/test/basetmtests.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import numpy as np
import six
class TestBaseTopi... | 1,947 | 34.418182 | 94 | py |
poincare_glove | poincare_glove-master/gensim/test/test_big.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking processing/storing large inputs.
"""
import logging
import unittest
import os
import numpy as np
im... | 2,435 | 31.918919 | 96 | py |
poincare_glove | poincare_glove-master/gensim/test/test_atmodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Radim Rehurek <radimrehurek@seznam.cz>
# Copyright (C) 2016 Olavur Mortensen <olavurmortensen@gmail.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for the author-topic model (AuthorTopicModel class... | 22,939 | 39.673759 | 109 | py |
poincare_glove | poincare_glove-master/gensim/test/test_corpora.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking corpus I/O formats (the corpora package).
"""
from __future__ import unicode_literals
import codecs
i... | 29,456 | 35.321825 | 106 | py |
poincare_glove | poincare_glove-master/gensim/test/test_glove2word2vec.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Test for gensim.scripts.glove2word2vec.py."""
import logging
import unittest
import os
import sys
import numpy
import gensim
from ... | 1,582 | 32.680851 | 115 | py |
poincare_glove | poincare_glove-master/gensim/test/__init__.py | """
This package contains automated code tests for all other gensim packages.
"""
| 82 | 19.75 | 73 | py |
poincare_glove | poincare_glove-master/gensim/test/test_fasttext_wrapper.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import os
import n... | 17,041 | 44.566845 | 120 | py |
poincare_glove | poincare_glove-master/gensim/test/test_segmentation.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for segmentation algorithms in the segmentation module.
"""
import logging
import unittest
import numpy as np
fr... | 2,046 | 30.015152 | 86 | py |
poincare_glove | poincare_glove-master/gensim/test/simspeed.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
USAGE: %(program)s CORPUS_DENSE.mm CORPUS_SPARSE.mm [NUMDOCS]
Run speed test of similarity queries. Only use the first NUMDOCS d... | 7,581 | 39.116402 | 113 | py |
poincare_glove | poincare_glove-master/gensim/test/test_doc2vec.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
from __future__ import with_statement
import log... | 25,377 | 42.23339 | 119 | py |
poincare_glove | poincare_glove-master/gensim/test/test_keras_integration.py | import unittest
import numpy as np
from gensim.models import word2vec
try:
from sklearn.datasets import fetch_20newsgroups
except ImportError:
raise unittest.SkipTest("Test requires sklearn to be installed, which is not available")
try:
import keras
from keras.engine import Input
from keras.models... | 6,028 | 38.927152 | 114 | py |
poincare_glove | poincare_glove-master/gensim/test/test_scripts.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 Manos Stergiadis <em.stergiadis@gmail.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking the output of gensim.scripts.
"""
from __future__ import unicode_literals
import json
import logg... | 3,744 | 33.357798 | 110 | py |
poincare_glove | poincare_glove-master/gensim/test/test_logentropy_model.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import numpy as np... | 2,093 | 32.238095 | 96 | py |
poincare_glove | poincare_glove-master/gensim/test/test_ldaseqmodel.py | """
Tests to check DTM math functions and Topic-Word, Doc-Topic proportions.
"""
import unittest
import logging
import numpy as np # for arrays, array broadcasting etc.
from gensim.models import ldaseqmodel
from gensim.corpora import Dictionary
from gensim.test.utils import datapath
class TestLdaSeq(unittest.Test... | 20,187 | 82.078189 | 119 | py |
poincare_glove | poincare_glove-master/gensim/test/test_similarities.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for similarity algorithms (the similarities package).
"""
import logging
import unittest
import os
import numpy
i... | 26,799 | 38.586411 | 119 | py |
poincare_glove | poincare_glove-master/gensim/test/test_corpora_dictionary.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Unit tests for the `corpora.Dictionary` class.
"""
from collections import Mapping
import logging
import unittest
import codecs
import os
import os.path
import scipy
import gensim
from gens... | 12,467 | 38.207547 | 104 | py |
poincare_glove | poincare_glove-master/gensim/test/test_tmdiff.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
import logging
import unittest
import numpy as np
from gensim.models import LdaModel
from gensim.test.utils import common_dictionary, c... | 2,920 | 39.013699 | 118 | py |
poincare_glove | poincare_glove-master/gensim/test/test_varembed_wrapper.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Anmol Gulati <anmol01gulati@gmail.com>
# Copyright (C) 2017 Radim Rehurek <radimrehurek@seznam.cz>
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for VarEmbed wrapper.
"""
import logging
import sys
... | 2,623 | 36.485714 | 109 | py |
poincare_glove | poincare_glove-master/gensim/test/test_keyedvectors.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Jayant Jain <jayantjain1992@gmail.com>
# Copyright (C) 2017 Radim Rehurek <me@radimrehurek.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking the poincare module from the models package.
"""
import ... | 6,544 | 39.90625 | 107 | py |
poincare_glove | poincare_glove-master/gensim/test/test_direct_confirmation.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for direct confirmation measures in the direct_confirmation_measure module.
"""
import logging
import unittest
from... | 3,057 | 38.714286 | 91 | py |
poincare_glove | poincare_glove-master/gensim/test/test_lsimodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import numpy as n... | 8,417 | 43.305263 | 120 | py |
poincare_glove | poincare_glove-master/gensim/test/test_phrases.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking transformation algorithms (the models package).
"""
import logging
import unittest
import six
from gensim.utils import to_unicode
from gensim.models.phrases im... | 26,276 | 40.316038 | 108 | py |
poincare_glove | poincare_glove-master/gensim/test/test_utils.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Automated tests for checking various utils functions.
"""
import logging
import unittest
import numpy as np
from six import iteritems
from gensim import utils
from gensim.test.utils import... | 7,758 | 34.108597 | 89 | py |
poincare_glove | poincare_glove-master/gensim/test/test_translation_matrix.py | #!/usr/bin/env python
# encoding: utf-8
from collections import namedtuple
import unittest
import math
import numpy as np
from scipy.spatial.distance import cosine
from gensim.models.doc2vec import Doc2Vec
from gensim import utils
from gensim.models import translation_matrix
from gensim.models import KeyedVectors
fro... | 5,123 | 42.058824 | 113 | py |
poincare_glove | poincare_glove-master/gensim/scripts/segment_wiki.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Jayant Jain <jayant@rare-technologies.com>
# Copyright (C) 2016 RaRe Technologies
"""This script using for extracting plain text out of a raw Wikipedia dump. Input is an xml.bz2 file provided
by MediaWiki that looks like <LANG>wiki-<YYYYMMDD>-pages-articles.xml... | 15,257 | 38.22365 | 120 | py |
poincare_glove | poincare_glove-master/gensim/scripts/package_info.py | """Get basic information about gensim & dependencies (useful for bug-reporting).
Examples
--------
You can use it through python
>>> from gensim.scripts.package_info import package_info
>>>
>>> info = package_info()
or using CLI interface
::
python -m gensim.scripts.package_info --info
.. program-output:: py... | 1,596 | 25.180328 | 117 | py |
poincare_glove | poincare_glove-master/gensim/scripts/make_wiki.py | make_wikicorpus.py | 18 | 18 | 18 | py |
poincare_glove | poincare_glove-master/gensim/scripts/word2vec_main.py | #!/usr/local/bin/python3
import argparse
import gensim
from gensim.models.callbacks import LossLogger, LossSetter, VectorNormLogger, WordEmbCheckpointSaver
from gensim.models.word2vec import InitializationConfig
from util_scripts.get_model_eval_and_stats import *
import logging
from nltk.corpus import brown
import num... | 28,081 | 50.811808 | 296 | py |
poincare_glove | poincare_glove-master/gensim/scripts/glove2word2vec.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Radim Rehurek <radimrehurek@seznam.cz>
# Copyright (C) 2016 Manas Ranjan Kar <manasrkar91@gmail.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""This script allows to convert GloVe vectors into the word2vec. Both fi... | 3,920 | 30.620968 | 119 | py |
poincare_glove | poincare_glove-master/gensim/scripts/make_wiki_online_lemma.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Copyright (C) 2012 Lars Buitinck <larsmans@gmail.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
USAGE: %(program)s WIKI_XML_DUMP OUTPUT_PREFIX [VOCABULARY_SIZE]
Convert a... | 4,582 | 39.557522 | 118 | py |
poincare_glove | poincare_glove-master/gensim/scripts/make_wiki_online.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Copyright (C) 2012 Lars Buitinck <larsmans@gmail.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
USAGE: %(program)s WIKI_XML_DUMP OUTPUT_PREFIX [VOCABULARY_SIZE]
Convert a... | 4,582 | 39.557522 | 118 | py |
poincare_glove | poincare_glove-master/gensim/scripts/make_wiki_lemma.py | make_wikicorpus.py | 18 | 18 | 18 | py |
poincare_glove | poincare_glove-master/gensim/scripts/eval_pretrained_emb.py | import gensim
import os
import sys
GOOGLE_SIZE = 19544
MSR_SIZE = 8000
filename = sys.argv[1]
restrict_vocab = 400000 # 189533
root = "../../../"
def precision(eval_result):
return len(eval_result['correct']) / (len(eval_result['correct']) + len(eval_result['incorrect']))
basename = os.path.basename(filename... | 3,718 | 51.380282 | 139 | py |
poincare_glove | poincare_glove-master/gensim/scripts/word2vec2tensor.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 Loreto Parisi <loretoparisi@gmail.com>
# Copyright (C) 2016 Silvio Olivastri <silvio.olivastri@gmail.com>
# Copyright (C) 2016 Radim Rehurek <radim@rare-technologies.com>
"""This script allows converting word-vectors from word2vec format into Tensor... | 3,735 | 38.326316 | 120 | py |
poincare_glove | poincare_glove-master/gensim/scripts/make_wiki_online_nodebug.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Copyright (C) 2012 Lars Buitinck <larsmans@gmail.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
USAGE: %(program)s WIKI_XML_DUMP OUTPUT_PREFIX [VOCABULARY_SIZE]
Convert a... | 4,582 | 39.557522 | 118 | py |
poincare_glove | poincare_glove-master/gensim/scripts/__init__.py | 0 | 0 | 0 | py | |
poincare_glove | poincare_glove-master/gensim/scripts/word2vec_standalone.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
USAGE: %(program)s -train CORPUS -output VECTORS -size SIZE -window WINDOW
-cbow CBOW -sample SAMPLE -hs HS -negative NEGATIVE -threads THREADS -iter ITER
-min_count MIN-COUNT -alpha ALPHA -b... | 5,966 | 40.4375 | 118 | py |
poincare_glove | poincare_glove-master/gensim/scripts/make_wikicorpus.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz>
# Copyright (C) 2012 Lars Buitinck <larsmans@gmail.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
USAGE: %(program)s WIKI_XML_DUMP OUTPUT_PREFIX [VOCABULARY_SIZE]
Convert a... | 4,582 | 39.557522 | 118 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/ldamodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Chinmaya Pancholi <chinmayapancholi13@gmail.com>
# Copyright (C) 2017 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-lear... | 5,783 | 40.314286 | 117 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/d2vmodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-learn
Follows scikit-learn API conventions
"""
import numpy as... | 4,008 | 38.693069 | 118 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/lsimodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Chinmaya Pancholi <chinmayapancholi13@gmail.com>
# Copyright (C) 2017 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-lear... | 3,449 | 35.315789 | 117 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/rpmodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Chinmaya Pancholi <chinmayapancholi13@gmail.com>
# Copyright (C) 2017 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-lear... | 2,212 | 34.126984 | 117 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/tfidf.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-learn
Follows scikit-learn API conventions
"""
from sklearn.ba... | 1,890 | 30.516667 | 117 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/hdp.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-learn
Follows scikit-learn API conventions
"""
import numpy as... | 4,204 | 36.212389 | 117 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/atmodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Chinmaya Pancholi <chinmayapancholi13@gmail.com>
# Copyright (C) 2017 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-lear... | 4,485 | 42.980392 | 120 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/text2bow.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-learn
Follows scikit-learn API conventions
"""
from six import... | 1,966 | 30.222222 | 117 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Chinmaya Pancholi <chinmayapancholi13@gmail.com>
# Copyright (C) 2017 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Scikit learn wrapper for gensim.
Contains various gensim based implementati... | 1,033 | 40.36 | 86 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/w2vmodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Chinmaya Pancholi <chinmayapancholi13@gmail.com>
# Copyright (C) 2017 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-lear... | 3,225 | 35.659091 | 117 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/ldaseqmodel.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Chinmaya Pancholi <chinmayapancholi13@gmail.com>
# Copyright (C) 2017 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-lear... | 3,151 | 38.4 | 117 | py |
poincare_glove | poincare_glove-master/gensim/sklearn_api/phrases.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Scikit learn interface for gensim for easy use of gensim with scikit-learn
Follows scikit-learn API conventions
"""
from six import... | 2,343 | 31.555556 | 117 | py |
poincare_glove | poincare_glove-master/gensim/similarities/docsim.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""Computing similarities across a collection of documents in the Vector Space Model.
The main class is :class:`~gensim.similarity.docs... | 48,317 | 38.735197 | 120 | py |
poincare_glove | poincare_glove-master/gensim/similarities/__init__.py | """
This package contains implementations of pairwise similarity queries.
"""
# bring classes directly into package namespace, to save some typing
from .docsim import Similarity, MatrixSimilarity, SparseMatrixSimilarity, SoftCosineSimilarity, WmdSimilarity # noqa:F401
| 271 | 37.857143 | 122 | py |
poincare_glove | poincare_glove-master/gensim/similarities/index.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Radim Rehurek <me@radimrehurek.com>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Intro
-----
This module contains integration Annoy with :class:`~gensim.models.word2vec.Word2Vec`,
:class:`~gensim.models.doc2vec.Doc2V... | 7,557 | 34.990476 | 119 | py |
poincare_glove | poincare_glove-master/glove_code/setup.py | from setuptools import setup, Extension
from Cython.Distutils import build_ext
import numpy as np
NAME = "glove"
VERSION = "0.1"
DESCR = "Python implementation of GloVe"
URL = "http://www.google.com"
REQUIRES = ['numpy', 'cython']
AUTHOR = "Alexandru Tifrea"
EMAIL = "tifreaa@ethz.ch"
LICENSE = "Apache 2.0"
SRC_DIR ... | 1,130 | 24.133333 | 55 | py |
poincare_glove | poincare_glove-master/glove_code/src/glove.py | from gensim.models.word2vec import WordEmbeddingCheckpoints
from gensim.utils import SaveLoad
from gensim.models.keyedvectors import VanillaWordEmbeddingsKeyedVectors, PoincareWordEmbeddingsKeyedVectors, Vocab, \
MixPoincareWordEmbeddingsKeyedVectors
from glove_code.src.glove_inner import read_all
from glove_code.s... | 22,886 | 47.386892 | 311 | py |
poincare_glove | poincare_glove-master/glove_code/src/utils.py | from numpy import inf, nan
def is_number(x):
if x not in [inf, -inf, nan]:
return True
else:
return False
| 132 | 13.777778 | 33 | py |
poincare_glove | poincare_glove-master/glove_code/scripts/glove_main.py | #!/usr/local/bin/python3
import argparse
import gensim
from gensim.models.callbacks import WordEmbCheckpointSaver
from glove_code.src.glove import Glove, NNConfig, InitializationConfig
from util_scripts.get_model_eval_and_stats import *
import logging
from nltk.corpus import brown
import numpy as np
from numpy import ... | 32,472 | 51.715909 | 206 | py |
poincare_glove | poincare_glove-master/plot/plot_train_loss.py | #!/usr/local/bin/python3
import matplotlib
import numpy as np
import os
import sys
if matplotlib.get_backend() != "MacOSX" and os.environ.get('DISPLAY') is None:
matplotlib.use('Agg')
import matplotlib.pyplot as plt
"""
argv[1] = one train log file and it will plot the info about the loss and the word similarity... | 2,485 | 32.146667 | 118 | py |
poincare_glove | poincare_glove-master/plot/plot_word2vec_training.py | #!/usr/local/bin/python3
import matplotlib
import numpy as np
import os
import sys
if matplotlib.get_backend() != "MacOSX" and os.environ.get('DISPLAY') is None:
matplotlib.use('Agg')
import matplotlib.pyplot as plt
"""
argv[1] = one log file and it will plot the evolution of the word similarity scores
argv[2] =... | 3,102 | 35.940476 | 118 | py |
poincare_glove | poincare_glove-master/plot/plot_glove_training.py | #!/usr/local/bin/python3
import matplotlib
import numpy as np
import os
import sys
if matplotlib.get_backend() != "MacOSX" and os.environ.get('DISPLAY') is None:
matplotlib.use('Agg')
import matplotlib.pyplot as plt
"""
argv[1] = one log file and it will plot the evolution of the word similarity scores
argv[2] =... | 4,485 | 38.008696 | 118 | py |
poincare_glove | poincare_glove-master/docker/check_fast_version.py | import sys
try:
from gensim.models.word2vec_inner import FAST_VERSION
print('FAST_VERSION ok ! Retrieved with value ', FAST_VERSION)
sys.exit()
except ImportError:
print('Failed... fall back to plain numpy (20-80x slower training than the above)')
sys.exit(-1)
| 283 | 24.818182 | 87 | py |
poincare_glove | poincare_glove-master/docs/src/conf.py | # -*- coding: utf-8 -*-
#
# gensim documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 17 13:42:21 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | 7,370 | 32.657534 | 114 | py |
poincare_glove | poincare_glove-master/docs/notebooks/test_notebooks.py | import os
import sys
import tempfile
from glob import glob
import nbformat
from nbconvert.preprocessors import ExecutePreprocessor
from nbconvert.preprocessors.execute import CellExecutionError
def _notebook_run(path):
"""Execute a notebook via nbconvert and collect output.
:returns (parsed nb object, exe... | 1,426 | 29.361702 | 78 | py |
poincare_glove | poincare_glove-master/util_scripts/nickel_transitive_closure.py | #!/usr/bin/env python3
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from nltk.corpus import wordnet as wn
# make sure each edge is included only once
edges = set()
for syn... | 1,008 | 35.035714 | 72 | py |
poincare_glove | poincare_glove-master/util_scripts/extract_coocc_pairs_restrict_vocab.py | from glove_code.src.glove_inner import extract_restrict_vocab_pairs
import sys
in_file = sys.argv[1]
out_file = sys.argv[2]
restrict_vocab = 50000
num_pairs = extract_restrict_vocab_pairs(in_file, out_file, restrict_vocab=restrict_vocab)
print(num_pairs, "for a vocab of", restrict_vocab, "words")
# basename = filena... | 496 | 30.0625 | 90 | py |
poincare_glove | poincare_glove-master/util_scripts/format_eval_logs.py | import glob
import os
import sys
model_path_pattern = sys.argv[1]
root = sys.argv[2]
def extract_scores_from_file(file):
scores = [-1] * 13
with open(file, "r") as f:
lines = f.readlines()
for line in lines:
if ":" not in line:
continue
line = line.stri... | 2,389 | 29.253165 | 94 | py |
poincare_glove | poincare_glove-master/util_scripts/text2bin_coocc_data.py | from glove_code.src.glove_inner import write_all, read_all
import sys
filename = sys.argv[1]
restrict_vocab = 200000
write_all(filename, restrict_vocab=restrict_vocab)
# basename = filename.rsplit(".", 1)[0]
# output = basename+"_vocab"+str(restrict_vocab)+".bin"
# print(output)
#
# num_pairs = read_all(use_glove_fo... | 366 | 25.214286 | 62 | py |
poincare_glove | poincare_glove-master/util_scripts/lexical_entailment_eval.py | import argparse
import gensim
from glove_code.src.glove import Glove
from gensim.models.keyedvectors import PoincareWordEmbeddingsKeyedVectors as pkv
from gensim.models.callbacks import LossLogger, LossSetter
import json
from nltk.corpus import wordnet as wn
import numpy as np
import os
import random
from scipy import ... | 16,440 | 40.309045 | 118 | py |
poincare_glove | poincare_glove-master/util_scripts/get_model_eval_and_stats.py | import argparse
import gensim
from glove_code.src.glove import Glove
from gensim.models.callbacks import LossLogger, LossSetter
import json
from nltk.corpus import wordnet as wn
import numpy as np
import os
import random
from scipy import stats
from sklearn.linear_model import RidgeCV
import sys
# TODO: maybe tune alp... | 13,038 | 44.432056 | 141 | py |
poincare_glove | poincare_glove-master/util_scripts/format_coocc_data.py | # OUTDATED
import sys
filename = sys.argv[1]
basename = filename.rsplit(".", 1)[0]
print(basename)
vocab = {}
with open("/Users/alext/Documents/Master/Thesis/data/wiki_coocc_data/w_freq.csv", "r") as f:
all_lines = f.readlines()
for line in all_lines:
index, word, count = line.strip().split("\t")
... | 710 | 29.913043 | 92 | py |
poincare_glove | poincare_glove-master/util_scripts/get_vocabulary_from_sim_dataset.py | import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--input_file', type=str,
help='File with the similarity pairs from which to extract the vocabulary')
parser.add_argument('--vocab_file', type=str,
help='Filenam... | 800 | 33.826087 | 99 | py |
poincare_glove | poincare_glove-master/util_scripts/extract_quads_for_avg_delta_hyperbolicity.py | import argparse
from gensim.models.keyedvectors import VanillaWordEmbeddingsKeyedVectors, Vocab
from glove_code.src.glove_inner import read_all, read_as_neighbor_lists
from numpy import array, uint32, save, median
from random import sample, randint, choice
from timeit import default_timer
PRINT_EVERY = 1
NUM_QUADS = ... | 5,923 | 41.927536 | 118 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.