Package seekfeel.dataholders

Examples of seekfeel.dataholders.SentenceFeaturePair


        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++;
                wrongNeg.add(tempEx.getTheFeature().Name + "---" + tempEx.getDataBody());
            } else {
                numNotClassified++;
                notClassified.add(tempEx.getTheFeature().Name + "---" + tempEx.getDataBody());
            }
        }

        EvaluationMeasures evMeasures = new EvaluationMeasures();
        evMeasures.setMeasures(allClassifiedPos, allClassifiedNeg, truePositive, trueNegative);
View Full Code Here


        for (Review review : allReviews) {
            for (int i = 0; i < review.Review_Sentences.size(); i++) {
                for (int j = 0; j < review.Sentences_Features.get(i).size(); j++) {
                    if (review.Sentences_Features.get(i).get(j).Rank > 0) {
                        positiveExamples.add(new SentenceFeaturePair(review.Sentences_Features.get(i).get(j), review.Review_Sentences.get(i)));
                    } else {
                        negativeExamples.add(new SentenceFeaturePair(review.Sentences_Features.get(i).get(j), review.Review_Sentences.get(i)));
                    }
                }
            }
        }
        cHolder.setPositiveExamples(positiveExamples);
View Full Code Here

TOP

Related Classes of seekfeel.dataholders.SentenceFeaturePair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.