PipeGen.java
2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package is2.data;
public class PipeGen {
public static final String SENSE = "SENSE", POS = "POS", DIST = "DIST", WORD = "WORD", PRED = "PRED", ARG = "ARG",
FEAT = "F", REL = "REL", TYPE = "TYPE", CHAR = "C", FFEATS = "FF", DIR = "DIR", LA = "LA", RA = "RA";
public static final String GPOS = "GPOS", MID = "MID", END = "END", STR = "STR", FM = "FM", NOFEAT = "NOFEAT";
public static final String _0 = "0", _4 = "4", _3 = "3", _2 = "2", _1 = "1", _5 = "5", _10 = "10";
static public int outValue(int num1, int del) {
String out = "" + num1;
StringBuffer delS = new StringBuffer();
for (int k = 0; k < del; k++)
delS.append('\b');
del = out.length();
System.out.print(delS + out);
return del;
}
static public int outValue(int num1, int del, long last) {
String out = "" + num1 + " (" + (System.currentTimeMillis() - last) / (num1 + 1) + " ms/instance)";
StringBuffer delS = new StringBuffer();
for (int k = 0; k < del; k++)
delS.append('\b');
del = out.length();
System.out.print(delS + out);
return del;
}
static public int outValueErr(int num1, float err, float f1, int del, long last) {
String out = "" + num1 + " (" + (System.currentTimeMillis() - last) / (num1 + 1) + " ms/instance "
+ (err / num1) + " err/instance f1=" + f1 + ") ";
StringBuffer delS = new StringBuffer();
for (int k = 0; k < del; k++)
delS.append('\b');
del = out.length();
System.out.print(delS + out);
return del;
}
static public int outValueErr(int num1, float err, float f1, int del, long last, double upd) {
String out = "" + num1 + " (" + (System.currentTimeMillis() - last) / (num1 + 1) + " ms/instance "
+ (err / num1) + " err/instance f1=" + f1 + ") upd " + upd;
StringBuffer delS = new StringBuffer();
for (int k = 0; k < del; k++)
delS.append('\b');
del = out.length();
System.out.print(delS + out);
return del;
}
static public int outValueErr(int num1, float err, float f1, int del, long last, double upd, String info) {
String out = "" + num1 + " (" + (System.currentTimeMillis() - last) / (num1 + 1) + " ms/instance "
+ (err / num1) + " err/instance f1=" + f1 + ") upd " + upd + " " + info;
StringBuffer delS = new StringBuffer();
for (int k = 0; k < del; k++)
delS.append('\b');
del = out.length();
System.out.print(delS + out);
return del;
}
/**
* @param cnt
* @param l
* @return
*/
public static String getSecondsPerInstnace(int cnt, long l) {
return " " + (l / (cnt * 1000f)) + " seconds/sentnece ";
}
/**
* @param l
* @return
*/
public static String getUsedTime(long l) {
return "Used time " + ((l) / 1000f) + " seconds ";
}
}