当前位置: 首页>>代码示例>>Java>>正文


Java LineInput类代码示例

本文整理汇总了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();
}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:43,代码来源:C99.java

示例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());
}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:19,代码来源:AccInt.java

示例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());
}
 
开发者ID:DrDub,项目名称:uima-text-segmenter,代码行数:11,代码来源:AccInt.java


注:本文中的uk.ac.man.cs.choif.extend.io.LineInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。