}
}
}
public EvaluationMeasures evaluateClassifer() {
SentiPanel classifier = new SentiPanel();
ArrayList<String> wrongPos = new ArrayList<String>();
ArrayList<String> wrongNeg = new ArrayList<String>();
ArrayList<String> notClassified = new ArrayList<String>();
ArrayList<DataUnit> positiveExamples = annotatedCorpus.getPositiveExamples();
ArrayList<DataUnit> negativeExamples = annotatedCorpus.getNegativeExamples();
int numExs = positiveExamples.size() < negativeExamples.size() ? positiveExamples.size() : negativeExamples.size();
int truePositive = 0;
int trueNegative = 0;
int allClassifiedPos = 0;
int allClassifiedNeg = 0;
Sentiment currentLabel;
int numNotClassified = 0;
SentenceFeaturePair tempEx;
ArrayList<String> currentFeatures = new ArrayList<String>();
for (int i = 0; i < numExs; i++) {
tempEx = (SentenceFeaturePair) positiveExamples.get(i);
currentFeatures.clear();
currentFeatures.add(tempEx.getTheFeature().Name);
currentLabel = classifier.classifyText(tempEx.getDataBody(), currentFeatures).get(tempEx.getTheFeature().Name);
if (currentLabel == Sentiment.Positive) {
truePositive++;
allClassifiedPos++;
} else if (currentLabel == Sentiment.Negative) {
allClassifiedNeg++;
wrongPos.add(tempEx.getTheFeature().Name + "---" + tempEx.getDataBody());
} else {
numNotClassified++;
notClassified.add(tempEx.getTheFeature().Name + "---" + tempEx.getDataBody());
}
}
for (int i = 0; i < numExs; i++) {
tempEx = (SentenceFeaturePair) negativeExamples.get(i);
currentFeatures.clear();
currentFeatures.add(tempEx.getTheFeature().Name);
currentLabel = classifier.classifyText(tempEx.getDataBody(), currentFeatures).get(tempEx.getTheFeature().Name);
if (currentLabel == Sentiment.Negative) {
trueNegative++;
allClassifiedNeg++;
} else if (currentLabel == Sentiment.Positive) {
allClassifiedPos++;