Here is what I performed:
Installed pip3 install glove_py ok. In Jupyter Python, import glove works ok.
from glove import *
Problem:
When I try a basic setup code to ensure all the modules are loaded and working. I have this code, which errors on message: "NameError: name 'glove' is not defined". Now since module glove import works ok, I have tried function 'glove' and 'Glove', both with NameError not defined.
I did find libraries like 'git clone http://github.com/stanfordnlp/glove' and did download and build the code with make. This code ran ok in the console for a sample.
pip3 install glove_py
Pip install for glove_py installed ok.
pip3 install glove_python
But pip install for glove_python failed to install with "Error Command errored out with exit status 1:".
glove && make
mkdir -p build
glove 'git clone http://github.com/stanfordnlp/glove' download ok and build with make ok. But even with this make'd version, I was not able to get the Python import glove to find this c code make realized inside the Jupyter Python environment.
I suspect that I am missing something simple, I would appreciate any insight.
Python code, test run. Here is my Python code test run which failed on module not found.
model = glove(df, vocab_size=3, d=50, alpha=0.75, x_max=100.0)
model.train(df)
model.to_txt()
words = model.most_similary("one", 10)
NameError Traceback (most recent call last)
<ipython-input-11-517b339bba36> in <module>
----> 1 model = glove(df, vocab_size=3, d=50, alpha=0.75, x_max=100.0)
2 model.train(df)
3 model.to_txt()
4 words = model.most_similary("one", 10)
5 print(words)
NameError: name 'glove' is not defined
Directory function to see the functions inside 'gl' module, imported from glove package, no module function names showed. So this clearly shows that the import of glove as gl, had some issues.
dir(gl)
['__doc__',
'__file__',
'__loader__',
'__name__',
'__package__',
'__path__',
'__spec__']
What you want is the Glove
class inside the module; note the capital letter.
I think this line
glove(df, vocab_size=3, d=50, alpha=0.75, x_max=100.0)
should be
Glove(df, vocab_size=3, d=50, alpha=0.75, x_max=100.0)