當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。