我找到了OpenNLP的部分代码,它向我展示了如何计算真正的正值。我想知道在使用OpenNLP句子评估工具时如何计算假阴性值。换句话说,使用精度,召回和F测量在评估工具方面意味着什么?用例子解释会很精彩。 (对不起我的愚蠢问题,我对NLP来说是全新的......)
public static int countTruePositives(final Object[] references, final Object[] predictions) {
List<Object> predListSpans = new ArrayList<Object>(predictions.length);
Collections.addAll(predListSpans, predictions);
int truePositives = 0;
Object matchedItem = null;
for (int referenceIndex = 0; referenceIndex < references.length; referenceIndex++) {
Object referenceName = references[referenceIndex];
for (int predIndex = 0; predIndex < predListSpans.size(); predIndex++) {
if (referenceName.equals(predListSpans.get(predIndex))) {
matchedItem = predListSpans.get(predIndex);
truePositives++;
}
}
if (matchedItem != null) {
predListSpans.remove(matchedItem);
}
}
return truePositives;
答案 0 :(得分:0)