0

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?

1
  • It looks like evaluate_features is attempting to evaluate functions and mostly likely uses that function and calls it with certain parameters. It would be helpful to post the definition of evaluate_features to be sure Commented Jul 21, 2016 at 19:16

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks @khredos, the point you made about passing "make_full_dict" return value vs the function itself makes a lot of sense. Cheers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.