0
$\begingroup$

I am new to text mining and have been playing around with the code provided in the book Applied Text Analysis With Python. I came to a problem with this specific part:

https://github.com/foxbook/atap/blob/master/snippets/ch08/oz.py

In this python script, most of the code is commented out. Is there a specific reason why someone would do that? What's the correct way to uncomment it?

I am using jupyter notebook, I pasted the code in a cell and deleted one by one each '#', but I think I messed up the indentation.

$\endgroup$
1
$\begingroup$

Welcome to the site! It looks to me that the code you reference is just showing some example usage for the functions defined above it. There are several reasons someone might do this--sometimes it's so auto-documentation generating code (e.g., doxygen) can pick up the example code for downstream formatting, other times it's so that the reader can identify the code they might need to modify for their own use case. I suspect the latter here. If you're interested in trying to just run the code as written, you could copy it into a text editor like TextMate or VSCode and do a vertical select (usually shift+option+click/drag) to highlight and delete the comment characters!

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.