Question

I would like to draw a tree like structure using Tkinter for the following data:

 S--->NP VGF NP VGNF
 NP--->N_NNP_O_M        
 VGF--->V_VM_VF     
 NP--->N_NNP_S_F        
 VGNF--->V_VM_VNF       

 V_VM_VF--->എത്തി   
 N_NNP_S_F--->സീതയെ 
 V_VM_VNF--->കാണാന്‍    
 N_NNP_O_M--->രാമൻ  

This is the CFG rules for a single sentence, it written in a file.

How can i view these rules in the form of tree in python? That is parse tree.

How can I draw the tree using Tkinter in GUI.

Any help or any hint will be very much appreciated.

Was it helpful?

Solution

do you have a parser if yes.then you will get parsetree when running that parser.

i think you have grammer but no parser.. if yes ....then use parser generaters to make parser. to make parser you must give grammer to generaters...

and after getting parse tree.its easy to draw tree in gui. nltk is for natural language processing..

OTHER TIPS

yes .but its not clear that what type of data you have and which way must draw is you want only an image that looks like a tree. or is it draw with a widget if you need to draw that as an image use tkinter.canvas()### or use as widget tkinter.tree_view

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top