本文整理汇总了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);
}
}
}
}
示例2: smooth
import edu.berkeley.nlp.PCFGLA.UnaryCounterTable; //导入依赖的package包/类
public void smooth(UnaryCounterTable unaryCounter,
BinaryCounterTable binaryCounter);
示例3: smooth
import edu.berkeley.nlp.PCFGLA.UnaryCounterTable; //导入依赖的package包/类
public void smooth(UnaryCounterTable unaryCounter,
BinaryCounterTable binaryCounter) {
// perform no smoothing at all
}