[Tutor] about NLTK parser

Abdirizak abdi a_abdi406@yahoo.com
Sat May 24 10:59:01 2003


--0-192669929-1053788321=:60980
Content-Type: text/plain; charset=us-ascii

Hi 
I was trying to run a program to build a sentence tree, but the interpreter
is giving me an error such as the follows:
 
raceback (most recent call last):
  File "C:\Python22\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 301, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\Grammar\grammar_pp_02.py", line 41, in ?
AttributeError: 'NoneType' object has no attribute 'draw'
 
This is what I was trying to achieve in order to build a parse tree
of the sentence in the code:
 
>>> import nltk.parser
>>> import nltk.token
>>> parser = nltk.parser.ShiftReduceParser(G)
>>> tokenizer = nltk.token.WSTokenizer()
>>> tokens = tokenizer.tokenize('the man saw a woman in the garden')
>>> parse = parser.parse(tokens)
>>> parse.draw()  <----------------even if parser module loaded
                                            it is giving me an error

Does any body know NLTK problems associated with win32 ?

thanks in advance

 




---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
--0-192669929-1053788321=:60980
Content-Type: text/html; charset=us-ascii

<DIV>Hi </DIV>
<DIV>I was trying to run a program to build a sentence tree, but the interpreter</DIV>
<DIV>is giving me an error such as the follows:</DIV>
<DIV>&nbsp;</DIV>
<DIV><STRONG>raceback (most recent call last):<BR>&nbsp; File "C:\Python22\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 301, in RunScript<BR>&nbsp;&nbsp;&nbsp; exec codeObject in __main__.__dict__<BR>&nbsp; File "C:\Grammar\grammar_pp_02.py", line 41, in ?<BR>AttributeError: 'NoneType' object has no attribute 'draw'</STRONG></DIV>
<DIV><STRONG></STRONG>&nbsp;</DIV>
<DIV>This is what I was trying to achieve in order to build a parse tree</DIV>
<DIV>of the sentence in the code:</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt;&gt;&gt; import nltk.parser<BR>&gt;&gt;&gt; import nltk.token<BR>&gt;&gt;&gt; parser = nltk.parser.ShiftReduceParser(G)<BR>&gt;&gt;&gt; tokenizer = nltk.token.WSTokenizer()<BR>&gt;&gt;&gt; tokens = tokenizer.tokenize('the man saw a woman in the garden')<BR>&gt;&gt;&gt; parse = parser.parse(tokens)<BR>&gt;&gt;&gt; parse.draw()&nbsp; <STRONG>&lt;----------------even if parser module loaded</STRONG></DIV>
<DIV><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; it is giving me an error</STRONG></DIV>
<P>Does any body know NLTK problems associated with win32 ?</P>
<P>thanks in advance</P>
<P>&nbsp;</P>
<DIV><STRONG><BR></STRONG></DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
<a href="http://us.rd.yahoo.com/search/mailsig/*http://search.yahoo.com">The New Yahoo! Search</a> - Faster. Easier. Bingo.
--0-192669929-1053788321=:60980--