from scipy.sparse import rand
from textacy.vsm.matrix_utils import apply_idf_weighting
M = rand(m=100, n=100)
apply_idf_weighting(M)
produces the following error
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-29-4b99cfa2e2c2> in <module>()
3
4 M = rand(m=100, n=100)
----> 5 apply_idf_weighting(M)
/Users/iaincarmichael/anaconda/envs/py36/lib/python3.6/site-packages/textacy/vsm/matrix_utils.py in apply_idf_weighting(doc_term_matrix, idf_type)
191 where value (i, j) is the tfidf weight of term j in doc i
192 """
--> 193 idfs = get_inverse_doc_freqs(doc_term_matrix, idf_type=idf_type)
194 return doc_term_matrix.dot(sp.diags(idfs, 0))
195
TypeError: get_inverse_doc_freqs() got an unexpected keyword argument 'idf_type'
Your Environment
platform: darwin
python: 3.6.1 |Anaconda 4.4.0 (x86_64)| (default, May 11 2017, 13:04:09) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]
There is a typo in
textacy.vsm.matrix_utils.apply_idf_weighting()
line 193 which causes the function to break.Problem and solution
When
apply_idf_weighting
callsget_inverse_doc_freqs
is uses the key word argumentidf_type
when it should use the key word argumenttype_
(line 193).In other words, this line currently reads
but it should read
Steps to Reproduce (for bugs)
The following code
produces the following error
Your Environment