?? classifieddatum.java
字號(hào):
package edu.stanford.nlp.classify;import edu.stanford.nlp.dbm.Datum;import edu.stanford.nlp.process.Appliable;/** * Stores a classified Datum with predicted and correct labels. */public class ClassifiedDatum{ private final Datum datum; private final Object predictedLabel; private final Object correctLabel; private final boolean correct; /** * Constructs a new classification result for the given Datum with the given * predicted and correct labels. * @param datum Datum that was classified * @param predictedLabel label (class) predicted for this Datum by the Classifier * @param correctLabel correct label (class) to compare prediction to */ public ClassifiedDatum(Datum datum,Object predictedLabel,Object correctLabel) { this.datum=datum; this.predictedLabel=predictedLabel; this.correctLabel=correctLabel; correct=predictedLabel.equals(correctLabel); } /** * Constructs a new classificationr esult for the given Datum with the given * predicted label, and using the datum's label as the correct label. * @param datum Data that was classified (containing correct label) * @param predictedLabel label (class) predicted for this Datum by the Classifier */ public ClassifiedDatum(Datum datum,Object predictedLabel) { this(datum,predictedLabel,datum.label()); } /** Returns the classified Datum. */ public Datum getDatum() { return(datum); } /** Returns the label (class) predicted for the Datum by the Classifier. */ public Object getPredictedLabel() { return(predictedLabel); } /** Returns the corect label (class) for the Datum. */ public Object getCorrectLabel() { return(correctLabel); } /** Returns whether the predicted label matches the correct label. */ public boolean isCorrect() { return(correct); } /** Appliable that returns the Datum inside a ClassifiedDatum. */ public static Appliable datumExtractor() { return(datumExtractor); } /** Appliable that returns the Datum inside a ClassifiedDatum. */ private static class DatumExtractor implements Appliable { public Object apply(Object o) { return(((ClassifiedDatum)o).getDatum()); } } private static final Appliable datumExtractor=new DatumExtractor();}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -