I just completed TF1C3W1 assignment. Code works fine, but I’m getting the grading feedback:
“name ‘sentences’ is not defined”
With 0/20 for each function starting with Remove_Stopword()
Hello @kelle1ds ,
Welcome to the Community!
Send me your notebook via dm such that I can check where it went wrong.By clicking on the profile picture, you will see an option to message.There you can attach your notebook.Then we can discuss the issues here, under the topic you created, on discourse.
With regards,
Nilosree Sengupta
I fixed the problem. I put the ‘sentences,labels = parse_data_from_file()’ method in its on cell for debugging. This apparently confused your grader algorithm. I’m good to go now.
Thanks a bunch, buddy! I had done the same
Hi Nilosree,
I have a same issue. I have sent you my code. Could you have a look? Thanks
Hello @Man_Yau ,
I have checked your code.
Your error is : stopwords not defined.
- Under def parse_data_from_file(filename) in Reading the raw data , what you have done is again calling
stopwords
that belong todef remove_stopwords(sentence)
.Hence it is not global.It is locally belonging to the function:remove_stopwords()
So, when you are calling it under function : def parse_data_from_file( ), it’s showing stopwords not defined.
- Next what you have done is again writing the algorithm for removal of stopwords under
def parse_data_from_file()
, which shouldn’t be done.You have already created a function above it to remove stopwords.
(We write functions, so that we don’t need to write algo again and again, and the job can be done just by calling the function and passing the parameter.)
So in that section, under def parse_data_from_file(filename)
, now you just need to:
- call that function :
remove_stopwords( )
and pass parameter - sentence in it, instead of writing again the algorithm . - Then just append it into
sentences
.
Hope this helps!
With regards,
Nilosree Sengupta
Hello @Man_Yau ,
Let me know if your problem is solved or not.
If you have any doubt, let me know.
With regards,
Nilosree Sengupta