is2.data.Parse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of anna Show documentation
Show all versions of anna Show documentation
Tools for Natural Language Analysis, Generation and Machine Learning
The newest version!
package is2.data;
import java.util.BitSet;
public class Parse implements Comparable {
public short[] heads;
public short[] labels;
public double f1;
public Parse() {}
public Parse(int i) {
heads = new short[i];
labels = new short[i];
}
/**
* @param heads2
* @param types2
* @param p_new
*/
public Parse(short[] heads2, short[] types2, float p_new) {
this.heads = new short[heads2.length];
this.labels = new short[types2.length];
// this.heads=heads2;
// this.labels=types2;
System.arraycopy(heads2, 0, heads, 0, heads.length);
System.arraycopy(types2, 0, labels, 0, labels.length);
f1=p_new;
}
/**
* @param heads2
* @param types2
* @param p_new
*/
public Parse(String parse, float p_new) {
// this(parse.length()/2);
signature2parse(parse);
f1=p_new;
}
public void signature2parse(String parse) {
int p=0;
heads = new short[parse.length()/2];
labels = new short[heads.length];
// DB.println("pl "+parse.length());
for(int k=0;k