public class BinaryRule extends Object implements Rule, Comparable<BinaryRule>, Serializable
Modifier and Type | Field and Description |
---|---|
int |
leftChild |
int |
parent |
int |
rightChild |
float |
score
Score should be a log probability
|
Constructor and Description |
---|
BinaryRule(int parent,
int leftChild,
int rightChild)
Create a new BinaryRule with the parent and children coded as ints.
|
BinaryRule(int parent,
int leftChild,
int rightChild,
double score) |
BinaryRule(String s,
Index<String> index)
Creates a BinaryRule from String s, assuming it was created using toString().
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(BinaryRule br) |
boolean |
equals(Object o) |
int |
hashCode() |
int |
parent() |
float |
score() |
String |
toString() |
String |
toString(Index<String> index) |
String |
toStringNoScore(Index<String> index) |
public int parent
public float score
public int leftChild
public int rightChild
public BinaryRule(int parent, int leftChild, int rightChild)
parent
- The parent intleftChild
- The left child intrightChild
- The right child intpublic BinaryRule(int parent, int leftChild, int rightChild, double score)
public BinaryRule(String s, Index<String> index)
s
- A String in which the binary rule is represented as parent,
left-child, right-child, score, with the items quoted as neededindex
- Index used to convert String names to intspublic int compareTo(BinaryRule br)
compareTo
in interface Comparable<BinaryRule>