class TensorTree[T] extends Serializable
TensorTree class is used to decode a tensor to a tree structure.
The given input content is a tensor which encodes a constituency parse tree.
The tensor should have the following structure:
Each row of the tensor represents a tree node and the row number is node number
For each row, except the last column, all other columns represent the children
node number of this node. Assume the value of a certain column of the row is not zero,
the value p means this node has a child whose node number is p (lies in the p-th)
row. Each leaf has a leaf number, in the tensor, the last column represents the leaf number.
Each leaf does not have any children, so all the columns of a leaf except the last should
be zero. If a node is the root, the last column should equal to -1.
Note: if any row for padding, the padding rows should be placed at the last rows with all
elements equal to -1.
eg. a tensor represents a binary tree:
[11, 10, -1; 0, 0, 1; 0, 0, 2; 0, 0, 3; 0, 0, 4; 0, 0, 5; 0, 0, 6; 4, 5, 0; 6, 7, 0; 8, 9, 0; 2, 3, 0; -1, -1, -1; -1, -1, -1]
- T
Numeric type Float or Double
- Alphabetic
- By Inheritance
- TensorTree
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
TensorTree(content: Tensor[T])(implicit arg0: ClassTag[T], ev: TensorNumeric[T])
- content
the tensor to be encoded
- ev
implicit tensor numeric
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addChild(parent: Int, child: T): Unit
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def children(index: Int): Array[Int]
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
- val content: Tensor[T]
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def exists(index: Int): Boolean
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getRoot: Int
- def hasChild(index: Int): Boolean
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isPadding(index: Int): Boolean
- def leafIndex(index: Int): Int
- def markAsLeaf(index: Int, leafIndex: Int): Unit
- def markAsRoot(index: Int): Unit
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def noChild(index: Int): Boolean
- def nodeNumber: Int
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def size: Array[Int]
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )