public double bigramPMI(String bigram,String []bi) {
String[] arr = bigram.split(" ");
int n11 = 0, n12 = 0, n21 = 0, n22 = 0, n1p = 0, np1 = 0, n2p = 0, np2 = 0, npp = 0;
double m11 = 0, PMI = 0;
for (int i = 0; i < bi.length; i++) {
String temp = bi[i];
if (bigram.equalsIgnoreCase(temp)) {
n11++;
}
if (temp.startsWith(arr[0]) && !temp.endsWith(arr[1])) {
n12++;
}
if (!temp.startsWith(arr[0]) && temp.endsWith(arr[1])) {
n21++;
}
if (temp.startsWith(arr[0])) {
n1p++;
}
if (temp.endsWith(arr[1])) {
np1++;
}
}
n22 = bigrame.size() - n11;
n2p = bigrame.size() - n1p;
np2 = bigrame.size() - np1;
npp = bigrame.size();
m11 = (np1 * n1p) / npp;
PMI = Math.log(n11 / m11) / Math.log(2);
return PMI;
}
the problem is the code evalute if condition with false even it take clear and true data
can any one help
i will be grateful
Thanks all