我只是要显示解析树。我有一个已经解析的句子,现在我只需要按节点显示它。显示部分
display_tree :-
sformat(A, 'Display tree ~w', vertical),
new(D, window(A)),
send(D, size, size(350,200)),
new(T, tree(text('Root'))),
send(T, neighbour_gap, 10),
new(S1, node(text('Child1'))),
new(S2, node(text('Child2'))),
send_list(T, son,[S1,S2]),
new(S11, node(text('Grandchild1'))),
new(S12, node(text('Grandchild2'))),
send_list(S1, son, [S11, S12]),
new(S21, node(text('Grandchild3'))),
new(S22, node(text('Grandchild4'))),
send_list(S2, son, [S21, S22]),
send(T, direction, vertical),
send(D, display, T),
send(D, open).
我希望显示这句话
s(np(d(the),n(boy),rel(rpn(who),vp(iv(sits)))),vp(tv(reads),np(d(a),n(book))))
我的目标是
new(T,tree(text('s')))
new(S1, node(text('np'))),
new(S2, node(text('vp'))), etc,.
有没有简单的解决方案???