I'm trying out some Text Classification tutorials here:
I don't understand the function calls in line 59 -- 65:
#creates a feature selection mechanism that uses all words
def make_full_dict(words):
return dict([(word, True) for word in words])
#tries using all words as the feature selection mechanism
print 'using all words as features'
evaluate_features(make_full_dict)
Shouldn't make_full_dict
be called with a string input value for words
?
Without further context, it is a bit difficult to give a complete answer to your question. It seems that the evaluate_features
method takes a function as parameter; in that case, you don't need to call the function which was passed in as a parameter. Only evaluate_features
should do that. If you call the function, then the return value of the function is what evaluate_features
will get, rather than the function itself
If you want to see what that function is doing, add some print statements in the make_full_dict
method which will help you see what words were passed to it