plz help me..I am doing parser for malayalam

52 views
Skip to first unread message

Dhanya L K

unread,
Nov 16, 2017, 5:07:52 AM11/16/17
to nltk-users
File "Gui.py", line 111, in tree
    tree=Tree.parse(text)
AttributeError: type object 'Tree' has no attribute 'parse'


This is an error ..when i was generating tree

def tree():                 
    f1 = open('struct.txt')
    text = f1.read()
    tree=Tree.parse(text)
    f1.close()
    tree.draw()

struct.txt contains (S(NP(N_NN_S_NU(അവന്റെ)))(NP(N_NNP(കൈയിലെ)))(NP(N_NN(ഭക്ഷണം)))(RBP(RB(കാലി)))(VGF(V_VM_VF(ആക്കി))))

Dimitriadis, A. (Alexis)

unread,
Nov 16, 2017, 5:23:59 AM11/16/17
to nltk-...@googlegroups.com
    tree=Tree.parse(text)
AttributeError: type object 'Tree' has no attribute 'parse'

You must be looking at an old tutorial or documentation page. The `Tree.parse()` method has been renamed `Tree.from_string()`. 

After fixing this code, find an up to date version of your text because many other things have changed since then.

Alexis

--
You received this message because you are subscribed to the Google Groups "nltk-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nltk-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dhanya L K

unread,
Nov 21, 2017, 12:50:52 AM11/21/17
to nltk-users
Tree.from_string(s)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'Tree' has no attribute 'from_string'


On Thursday, November 16, 2017 at 3:37:52 PM UTC+5:30, Dhanya L K wrote:
File "Gui.py", line 111, in tree
    tree=Tree.parse(text)
AttributeError: type object 'Tree' has no attribute 'parse'

again same error 

Dhanya L K

unread,
Nov 21, 2017, 1:13:42 AM11/21/17
to nltk-users
Its working..Thank you..


On Thursday, November 16, 2017 at 3:37:52 PM UTC+5:30, Dhanya L K wrote:
Reply all
Reply to author
Forward
0 new messages