}
// ��unknownDict�ʵ���л�ȡ��ǰ�����д���
ArrayList<WordItem> wis = unknownDict.getHandle(curWord);
for (int j = 0; wis != null && j < wis.size(); j++) {
WordItem wi = wis.get(j);
int tag = wi.getHandle();
double freq = -Math.log((1 + wi.getFreq()));
freq += Math.log((context.getFreq(0, wi.getHandle()) + wis.size() + 1));
POS pos = new POS(tag, freq);
sn.addPos(pos);
}
if (Utility.SENTENCE_BEGIN.equals(curWord))
sn.addPos(new POS(100, 0));
else if (Utility.SENTENCE_END.equals(curWord))
sn.addPos(new POS(101, 0));
else {
int nFreq = 0;
wis = coreDict.getHandle(curWord);
if (wis != null) {
for (WordItem wi : wis)
nFreq += wi.getFreq();
if (wis.size() > 0) {
double freq = -Math.log((double) (1 + nFreq));
freq += Math.log((double) (context.getFreq(0, 0) + wis.size()));
sn.addPos(new POS(0, freq));
}
}
}
} else {
if (sn.getPos() > 0) {
int tag = sn.getPos();
double value = -Math.log(sn.getValue());
value += Math.log(context.getFreq(0, tag));
if (value < 0)
value = 0;
sn.addPos(new POS(tag, value));
} else {
if (sn.getPos() < 0) {
sn.setPos(-sn.getPos());
sn.addPos(new POS(-sn.getPos(), sn.getValue()));
}
ArrayList<WordItem> wis = coreDict.getHandle(curWord);
if (wis != null) {
for (WordItem wi : wis) {
int tag = wi.getHandle();
double value = -Math.log(1 + wi.getFreq());
value += Math.log(context.getFreq(0, tag) + wis.size());
sn.addPos(new POS(tag, value));
}
}
}