![JAR search and dependency download from the Maven repository](/logo.png)
edu.berkeley.nlp.PCFGLA.smoothing.SmoothAcrossParentSubstate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of berkeleyparser Show documentation
Show all versions of berkeleyparser Show documentation
The Berkeley parser analyzes the grammatical structure of natural language using probabilistic context-free grammars (PCFGs).
The newest version!
/**
*
*/
package edu.berkeley.nlp.PCFGLA.smoothing;
import java.io.Serializable;
import edu.berkeley.nlp.PCFGLA.BinaryCounterTable;
import edu.berkeley.nlp.PCFGLA.BinaryRule;
import edu.berkeley.nlp.PCFGLA.UnaryCounterTable;
import edu.berkeley.nlp.PCFGLA.UnaryRule;
import edu.berkeley.nlp.util.Numberer;
/**
* @author leon
*
*/
public class SmoothAcrossParentSubstate implements Smoother, Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
double same;
double different;
public SmoothAcrossParentSubstate(double smooth) {
different = smooth;
same = 1-different;
}
/* (non-Javadoc)
* @see edu.berkeley.nlp.PCFGLA.smoothing.Smoother#smooth(edu.berkeley.nlp.util.UnaryCounterTable, edu.berkeley.nlp.util.BinaryCounterTable)
*/
public void smooth(UnaryCounterTable unaryCounter,
BinaryCounterTable binaryCounter) {
for (UnaryRule r : unaryCounter.keySet()) {
double[][] scores = unaryCounter.getCount(r);
double[][] scopy = new double[scores.length][];
for (int j=0; j
© 2015 - 2025 Weber Informatics LLC | Privacy Policy