def load(self): s = "(S (NP (N I)) (VP1 (VP2 (V saw) " \ "(NP (ART the) (N man))) (PP (P with) " \ "(NP (ART a) (N telescope)))))" self.root = TreeModel.importTreebank([s]).next() self.treeview.setData(self.root,[('label','Tree')]) self.vp1 = self.root.children[1] self.pp = self.vp1.children[1] self.vp2 = self.vp1.children[0] self.stage = 0 self.button2.setText('splice VP1')
from at4 import TreeEdit, TreeModel from PyQt4 import QtGui import sys if __name__ == "__main__": app = QtGui.QApplication(sys.argv) s = "(S (NP (N I)) (VP1 (VP2 (V saw) (NP (ART the) (N man))) " \ "(PP (P with) (NP (ART a) (N telescope)))))" root = TreeModel.importTreebank([s]).next() w = TreeEdit() w.setData(root) w.show() app.exec_()