>>> pip install fasttext
>>> import fasttext
>>> model = fasttext.load_model('cc.bn.300.bin')
>>> dir(model)
['__class__',
'__contains__',
'__delattr__',
'__dict__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getitem__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__le__',
'__lt__',
'__module__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'__weakref__',
'_labels',
'_words',
'f',
'get_dimension',
'get_input_matrix',
'get_input_vector',
'get_labels',
'get_line',
'get_output_matrix',
'get_sentence_vector',
'get_subword_id',
'get_subwords',
'get_word_id',
'get_word_vector',
'get_words',
'is_quantized',
'labels',
'predict',
'quantize',
'save_model',
'test',
'test_label',
'words']
Here we can see that there is no attribute get_nearest_neighbors but official documentation demands get_nearest_neighbors
!up
install fasttext via the github repo instead!
Thanks. It's working now.
I still have this problem even after installing the library from the github repo via
>>> git clone https://github.com/facebookresearch/fastText.git
>>> cd fastText
>>> python3 setup.py install
and I get the same output as in the original comment for dir(model)
I am trying to install fasttext from the github repo but I am on windows and make is not working out (I installed it using MinGW). I'm getting the following error:

Ok so my issue was that I am on windows and I did not have C++11 installed. I managed to install it using MinGW-w64. Now it worked out but I am getting the following error (PS: I am using fasttext for Arabic ==> cc.ar.300.bin):
ft.get_nearest_neighbors('賮賱爻胤賷賳'):
{Attribute Error}: fasttext_pybind.fasttext object has no attribute 'getNN'
No I am also not able to save the model:
model_path = 'E:/cc.ar.300.bin/cc.ar.300.bin'
path = 'E:/cc.ar.300.bin/'
file = 'cc.ar.300.bin'
t1 = time.time()
ft = fasttext.load_model(model_path)
t2 = time.time()
print('fasttext dimension: {}'.format(ft.get_dimension()))
# reduce the dimension fromm 300 to 200 and save
fasttext.util.reduce_model(ft, 200)
print('fasttext dimension: {}'.format(ft.get_dimension()))
ft.save_model(os.path.join(path, 'cc.ar.200.bin'))
fasttext.util.reduce_model(ft, 100)
print('fasttext dimension: {}'.format(ft.get_dimension()))
ft.save_model(os.path.join(path, 'cc.ar.100.bin'))
Gives the following errors:
Warning : `load_model` does not return WordVectorModel or SupervisedModel any more, but a `FastText` object which is very similar.
fasttext dimension: 300
Traceback (most recent call last):
File "C:/Users/96171/Desktop/newpaper_mining/topic_detection/test.py", line 16, in <module>
fasttext.util.reduce_model(ft, 200)
File "C:\Users\96171\AppData\Local\Programs\Python\Python36\lib\site-packages\fasttext\util\util.py", line 125, in reduce_model
ft_model.set_matrices(inp_reduced, out_reduced)
File "C:\Users\96171\AppData\Local\Programs\Python\Python36\lib\site-packages\fasttext\FastText.py", line 368, in set_matrices
self.f.setMatrices(input_matrix.astype(np.float32),
AttributeError: 'fasttext_pybind.fasttext' object has no attribute 'setMatrices'
Most helpful comment
install fasttext via the github repo instead!