本文整理汇总了Java中uk.ac.man.cs.choif.extend.io.LineInput类的典型用法代码示例。如果您正苦于以下问题:Java LineInput类的具体用法?Java LineInput怎么用?Java LineInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LineInput类属于uk.ac.man.cs.choif.extend.io包,在下文中一共展示了LineInput类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import uk.ac.man.cs.choif.extend.io.LineInput; //导入依赖的package包/类
/**
* Segment a piece of text using the C99 algorithm
* Creation date: (11/05/99 06:05:36)
* @param args java.lang.String[]
*/
public final static void main(String[] args) {
Debugx.header("This is C99, an algorithm for linear text segmentation.");
/* Command line arguments processing */
Argx arg = new Argx(args);
int n = arg.get("-n", -1, "Number of segments (default automatic = -1)");
int s = arg.get("-s", 11, "Size of ranking mask (>= 1 and an odd number)");
boolean w = arg.has("-w", false, "Weight context vector with term frequencies");
arg.displayHelp();
if (s < 1 || s % 2 != 1) Debugx.handle(new Error("Parameter -s must be >= 1 and an odd number."));
/* Load document */
Debugx.msg("C99", "Loading document...");
String[][] D = Stringx.tokenize(LineInput.load(new LineInput(System.in)), " ");
//String[][] D = null;
//try { D = Stringx.tokenize(LineInput.load(new LineInput(new java.io.File("/root/temp/test.txt"))), " "); }
//catch (java.io.IOException e) {}
/* Perform segmentation */
String[][][] S = (w ? segmentW(D, n, s) : segment(D, n, s));
Debugx.msg("C99", "Ready.");
/* Print output */
final String sep = "==========";
String line;
LineOutput out = new LineOutput(System.out);
for (int i=0, ie=S.length; i<ie; i++) {
out.println(sep);
for (int j=0, je=S[i].length; j<je; j++) {
line = "";
for (int k=0, ke=S[i][j].length; k<ke; k++) line += (S[i][j][k] + " ");
out.println(line);
}
}
out.println(sep);
out.close();
}
示例2: main
import uk.ac.man.cs.choif.extend.io.LineInput; //导入依赖的package包/类
/**
*
* Creation date: (09/12/99 04:06:09)
* @param args java.lang.String[]
*/
public static void main(String[] args) {
Debugx.header("This is JAccInt for measuring the statistical properties of an integer dataset. Expects a list of integers as input. Output format : <dataset name> <mean> <median> <s.d.> <variance> <min> <max> <count>");
Argx arg = new Argx(args);
String name = arg.get("-n", "No name", "Name of the dataset");
arg.displayHelp();
name.replace(' ', '_');
LineInput in = new LineInput(System.in);
AccInt acc = new AccInt(true, in);
// Print results
System.out.println(name + " " + acc.mean() + " " + acc.median() + " " + acc.sd() + " " + acc.variance() + " " + acc.min() + " " + acc.max() + " " + acc.count());
}
示例3: AccInt
import uk.ac.man.cs.choif.extend.io.LineInput; //导入依赖的package包/类
/**
*
* Creation date: (09/12/99 07:12:19)
* @param medianRequired boolean
* @param in uk.ac.man.cs.choif.extend.io.LineInput
*/
public AccInt(boolean medianRequired, LineInput in) {
this.medianRequired = medianRequired;
while (in.hasMoreElements()) acc(Integer.valueOf((String) in.nextElement()).intValue());
}