Python Forum
Dont quote me on this!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dont quote me on this!
#1
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.
Would you be able to explain in general what just happened?
"tokenized" is now given as a argument to the function,this make it clearer that is shall be used in function.
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.
Would you be able to explain in general what just happened?
"tokenized" is now given as a argument to the function,this make it clearer that is shall be used in function.
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]
Reply


Messages In This Thread
Dont quote me on this! - by Yoriz - Oct-20-2016, 09:44 PM
RE: Dont quote me on this! - by metulburr - Oct-20-2016, 09:48 PM
RE: Dont quote me on this! - by Yoriz - Oct-20-2016, 09:54 PM
RE: Dont quote me on this! - by snippsat - Oct-20-2016, 09:59 PM
RE: Dont quote me on this! - by Yoriz - Oct-20-2016, 10:02 PM
RE: Dont quote me on this! - by snippsat - Oct-20-2016, 10:06 PM
RE: Dont quote me on this! - by metulburr - Oct-20-2016, 10:06 PM
RE: Dont quote me on this! - by Yoriz - Oct-20-2016, 10:08 PM
RE: Dont quote me on this! - by Yoriz - Oct-20-2016, 10:09 PM
RE: Dont quote me on this! - by Root13 - Nov-03-2016, 02:23 PM
RE: Dont quote me on this! - by snippsat - Oct-20-2016, 10:16 PM
RE: Dont quote me on this! - by Larz60+ - Nov-03-2016, 04:19 PM
RE: Dont quote me on this! - by Kai. - Nov-07-2016, 06:47 PM
RE: Dont quote me on this! - by wavic - Nov-07-2016, 09:36 PM
RE: Dont quote me on this! - by Larz60+ - Nov-07-2016, 10:25 PM
RE: Dont quote me on this! - by metulburr - Nov-07-2016, 10:31 PM
RE: Dont quote me on this! - by Larz60+ - Nov-07-2016, 11:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Monty Python Quote Most Applicable to Programming ichabod801 4 3,022 Nov-07-2019, 03:25 PM
Last Post: stullis
  Dont keep this alive! Kai. 4 4,823 Nov-07-2016, 07:37 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020