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


Java Event类代码示例

本文整理汇总了Java中opennlp.model.Event的典型用法代码示例。如果您正苦于以下问题:Java Event类的具体用法?Java Event怎么用?Java Event使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Event类属于opennlp.model包,在下文中一共展示了Event类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readInXmiFiles

import opennlp.model.Event; //导入依赖的package包/类
/**
 * @param filePath
 *            the xmi file or directory path of the dataset
 * @return return the instances of the dataset, represented in
 *         <code>Event</code>s
 */
protected final EventStream readInXmiFiles(String filePath)
		throws ConfigurationException {
	List<Event> eventList = new ArrayList<Event>();
	File dir = new File(filePath);
	if (dir.isFile()) {
		eventList.add(readInXmiFile(dir.getAbsolutePath()));
	} else if (dir.isDirectory()) {
		for (File file : dir.listFiles()) {
			// ignore all the non-xmi files
			if (!file.getName().endsWith(".xmi")) {
				continue;
			}
			// add the instance to the dataset
			eventList.add(readInXmiFile(file.getAbsolutePath()));
		}
	}
	return new ListEventStream(eventList);
}
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:25,代码来源:MaxEntClassificationEDA.java

示例2: next

import opennlp.model.Event; //导入依赖的package包/类
public Event next() {
    int split = line.indexOf(' ');
    String outcome = line.substring(0, split);
    String question = line.substring(split + 1);
    Parse query = ParserTool.parseLine(question, parser, 1)[0];
    return (new Event(outcome, atcg.getContext(query)));
}
 
开发者ID:asmehra95,项目名称:wiseowl,代码行数:8,代码来源:AnswerTypeEventStream.java

示例3: toLine

import opennlp.model.Event; //导入依赖的package包/类
/**
 * Generates a string representing the specified event.
 *
 * @param event The event for which a string representation is needed.
 * @return A string representing the specified event.
 */
public static String toLine(Event event) {
    StringBuffer sb = new StringBuffer();
    sb.append(event.getOutcome());
    String[] context = event.getContext();
    for (int ci = 0, cl = context.length; ci < cl; ci++) {
        sb.append(" " + context[ci]);
    }
    sb.append(System.getProperty("line.separator"));
    return sb.toString();
}
 
开发者ID:asmehra95,项目名称:wiseowl,代码行数:17,代码来源:AnswerTypeEventStream.java

示例4: readInXmiFile

import opennlp.model.Event; //导入依赖的package包/类
/**
 * @param filePath
 *            the single xmi file path of the dataset
 * @return return the instance of that file, represented in
 *         <code>Event</code>
 */
protected final Event readInXmiFile(String filePath)
		throws ConfigurationException {
	try {
		File xmiFile = new File(filePath);
		return casToEvent(PlatformCASProber.probeXmi(xmiFile, System.out));
	} catch (LAPException e) {
		throw new ConfigurationException(e.getMessage());
	}
}
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:16,代码来源:MaxEntClassificationEDA.java

示例5: casToEvent

import opennlp.model.Event; //导入依赖的package包/类
/**
 * @param cas
 *            the <code>JCas</code> object
 * @return return the instance of the input, represented in
 *         <code>Event</code>
 */
protected final Event casToEvent(JCas cas) throws ConfigurationException {
	String goldAnswer = getGoldLabel(cas);
	if (null == goldAnswer) {
		goldAnswer = DecisionLabel.Abstain.toString();
	}
	try {
		String[] contexts = constructContext(cas);
		float[] values = RealValueFileEventStream.parseContexts(contexts);
		return new Event(goldAnswer, contexts, values);
	} catch (ScoringComponentException e) {
		throw new ConfigurationException(e.getMessage());
	}
}
 
开发者ID:hltfbk,项目名称:Excitement-TDMLEDA,代码行数:20,代码来源:MaxEntClassificationEDA.java


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