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


Java UnaryCounterTable类代码示例

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


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

示例1: testSmooth

import edu.berkeley.nlp.PCFGLA.UnaryCounterTable; //导入依赖的package包/类
public void testSmooth() {
	short pState = 1, lState = 2, rState = 3;
	short[] numSubStates = { 3, 3, 3, 3 };
	double[][] uScores = { { 1, 0, 0 }, { 1, 1, 1 }, { 0, 0, 1 } };
	double[][] targetUScores = { { 0.75, 0.25, 0.5 }, { 0.75, 0.5, 0.75 },
			{ 0.5, 0.25, 0.75 } };
	double[][][] bScores = { { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } },
			{ { 0, 1, 0 }, { 0, 0, 0 }, { 0, 0, 0 } },
			{ { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } } };
	double[][][] targetBScores = {
			{ { 0.5, 0.25, 0 }, { 0, 0.5, 0 }, { 0, 0, 0.5 } },
			{ { 0.25, 0.5, 0 }, { 0, 0.25, 0 }, { 0, 0, 0.25 } },
			{ { 0.25, 0.25, 0 }, { 0, 0.25, 0 }, { 0, 0, 0.25 } } };

	UnaryRule ur = new UnaryRule(pState, lState, uScores);
	BinaryRule br = new BinaryRule(pState, lState, rState, bScores);
	Smoother sm = new SmoothAcrossParentSubstate(0.5);
	UnaryCounterTable unaryCounter = new UnaryCounterTable(numSubStates);
	unaryCounter.setCount(ur, uScores);
	BinaryCounterTable binaryCounter = new BinaryCounterTable(numSubStates);
	binaryCounter.setCount(br, bScores);
	sm.smooth(unaryCounter, binaryCounter);

	double[][] newUScores = unaryCounter.getCount(ur);
	for (int i = 0; i < newUScores.length; i++) {
		for (int j = 0; j < newUScores[i].length; j++) {
			// assertEquals(newUScores[i][j],targetUScores[i][j],0.0001);
		}
	}
	double[][][] newBScores = binaryCounter.getCount(br);
	for (int i = 0; i < newBScores.length; i++) {
		for (int j = 0; j < newBScores[i].length; j++) {
			for (int k = 0; k < newBScores[i][j].length; k++) {
				// assertEquals(newBScores[i][j][k],targetBScores[i][j][k],0.0001);
			}
		}
	}
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:39,代码来源:SmoothAcrossParentSubstateTest.java

示例2: smooth

import edu.berkeley.nlp.PCFGLA.UnaryCounterTable; //导入依赖的package包/类
public void smooth(UnaryCounterTable unaryCounter,
BinaryCounterTable binaryCounter);
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:3,代码来源:Smoother.java

示例3: smooth

import edu.berkeley.nlp.PCFGLA.UnaryCounterTable; //导入依赖的package包/类
public void smooth(UnaryCounterTable unaryCounter,
		BinaryCounterTable binaryCounter) {
	// perform no smoothing at all
}
 
开发者ID:text-machine-lab,项目名称:CliRel,代码行数:5,代码来源:NoSmoothing.java


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