public int depth ( ) { if ( isLeaf ( ) ) { return 0 ; } int maxDepth = 0 ; List < Tree > kids = children ( ) ; for ( Tree kid : kids ) { int curDepth = kid . depth ( ) ; if ( curDepth > maxDepth ) { maxDepth = curDepth ; } } return maxDepth + 1 ; }
Finds the channels of the tree . The channels is defined as the length of the longest path from this node to a leaf node . Leaf nodes have channels zero . POS tags have channels 1 . Phrasal nodes have channels &gt ; = 2 .