inpho / vsm

Vector Space Model Framework developed for InPhO
http://inpho.github.io/vsm
Other
36 stars 14 forks source link

tfidf dist_doc_doc index out of bounds #159

Open colinallen opened 6 years ago

colinallen commented 6 years ago

(error when using SEP corpus)


tfi = TfIdf(c, context_type)
tfi.train()
tfi_v = TfIdfViewer(c,tfi)
tfi_v.dist_doc_doc(0)

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-111-4eb19a08b256> in <module>()
----> 1 tfi_v.dist_doc_doc(0)

/Users/colin_1/anaconda2/lib/python2.7/site-packages/vsm/viewer/tfidfviewer.pyc in dist_doc_doc(self, doc_or_docs, weights, print_len, filter_nan, label_fn, as_strings, dist_fn, order)
    135                               print_len=print_len, filter_nan=filter_nan,
    136                               label_fn=def_label_fn, as_strings=True,
--> 137                               dist_fn=dist_fn, order=order)
    138 
    139     @deprecated_meth("dist_word_doc")

/Users/colin_1/anaconda2/lib/python2.7/site-packages/vsm/viewer/wrappers.pyc in dist_doc_doc(doc_or_docs, corp, context_type, mat, weights, filter_nan, print_len, label_fn, as_strings, dist_fn, order)
    161         doc = csr_matrix(doc)
    162     else:
--> 163         cols = mat[:,docs]
    164         doc = np.average(cols, weights=weights, axis=1)
    165 

IndexError: index 0 is out of bounds for axis 1 with size 0