Oct-20-2016, 09:44 PM
Yoriz Wrote: Wrote:This thread needs the quote feature disabled. [Image: smiley-faces-75.gif]
(4 minutes ago)pythlang Wrote: Wrote:(25 minutes ago)snippsat Wrote: Wrote:(1 hour ago)pythlang Wrote: Wrote:I literally do not understand the difference."tokenized" is now given as a argument to the function,this make it clearer that is shall be used in function.
Would you be able to explain in general what just happened?
Global variables are usually not a good thing at all,will soon get messy.
Thanks for the clarification.
If I were adding code like this
def process_content(): try: for i in tokenized: words = nltk.word_tokenize(i) tagged = nltk.pos_tag(words) chunkGram = r"""Chunk: {<RB.?>*<VB.?>*<NNP><NN>?}""" chunkParser = nltk.RegexpParser(chunkGram) chunked = chunkParser.parse(tagged) chunked.draw() except Exception as e: print(str(e)) process_content()How would I write it instead using your method?
by the way, this is where "chunked.draw()" fails and I get no output to the screen because I'm not sure if my matplotlib path is correct.
(7 minutes ago)Yoriz Wrote: Wrote:This thread needs the quote feature disabled. [Image: smiley-faces-75.gif]
"What do you mean?"
-Justin Bieber
(2 minutes ago)Yoriz Wrote: Wrote:(7 minutes ago)Yoriz Wrote: Wrote:This thread needs the quote feature disabled. [Image: smiley-faces-75.gif]
(4 minutes ago)pythlang Wrote: Wrote:(25 minutes ago)snippsat Wrote: Wrote:(1 hour ago)pythlang Wrote: Wrote:I literally do not understand the difference."tokenized" is now given as a argument to the function,this make it clearer that is shall be used in function.
Would you be able to explain in general what just happened?
Global variables are usually not a good thing at all,will soon get messy.
Thanks for the clarification.
If I were adding code like this
def process_content(): try: for i in tokenized: words = nltk.word_tokenize(i) tagged = nltk.pos_tag(words) chunkGram = r"""Chunk: {<RB.?>*<VB.?>*<NNP><NN>?}""" chunkParser = nltk.RegexpParser(chunkGram) chunked = chunkParser.parse(tagged) chunked.draw() except Exception as e: print(str(e)) process_content()how would I write it instead using your method?
by the way, this is where "chunked.draw()" fails and I get no output to the screen because I'm not sure if my matplotlib path is correct.
[Image: bonk.gif] [Image: smiley-faces-75.gif]
If you cant beat them join them [Image: funnyface.gif]