public List<LabeledWord> labeledYield(List<LabeledWord> ty) {
Tree[] kids = children();
// this inlines the content of isPreTerminal()
if (kids.length == 1 && kids[0].isLeaf()) {
ty.add(new LabeledWord(kids[0].label(), label()));
} else {
for (Tree kid : kids) {
kid.labeledYield(ty);
}
}