本文整理汇总了Java中uk.ac.man.cs.choif.extend.Argx类的典型用法代码示例。如果您正苦于以下问题:Java Argx类的具体用法?Java Argx怎么用?Java Argx使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Argx类属于uk.ac.man.cs.choif.extend包,在下文中一共展示了Argx类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import uk.ac.man.cs.choif.extend.Argx; //导入依赖的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();
}