Package seekfeel.miners

Examples of seekfeel.miners.Sentiment


        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);
View Full Code Here


      // looping thru the hash<feat,senti>
      while(entriesIterator.hasNext())
      {
        currentEntry = entriesIterator.next();
        String keySentence = currentEntry.getKey();
        Sentiment valueSenti = currentEntry.getValue();
       
        if(summary.containsKey(keySentence)) // update
        {
          FeatureSummary tempFeatSumm = summary.get(keySentence);
          if(valueSenti.equals(Sentiment.Positive))
          {
            tempFeatSumm.setNumPositive(tempFeatSumm.getNumPositive()+1);
            tempFeatSumm.getPosReviews().add(sentenceWithFeats.getSentence());
          }
          else if(valueSenti.equals(Sentiment.Negative))
          {
            tempFeatSumm.setNumNegative(tempFeatSumm.getNumNegative()+1);
            tempFeatSumm.getNegReviews().add(sentenceWithFeats.getSentence());
          }
          else if(valueSenti.equals(Sentiment.Neutral))
          {
            tempFeatSumm.setNumNeutral(tempFeatSumm.getNumNeutral()+1);
            tempFeatSumm.getNeutralReviews().add(sentenceWithFeats.getSentence());
          }
        }
        else // create new
        {
          FeatureSummary tempFeatSumm = new FeatureSummary();
         
          if(valueSenti.equals(Sentiment.Positive))
          {
            tempFeatSumm.setNumPositive(tempFeatSumm.getNumPositive()+1);
            tempFeatSumm.getPosReviews().add(sentenceWithFeats.getSentence());
          }
          else if(valueSenti.equals(Sentiment.Negative))
          {
            tempFeatSumm.setNumNegative(tempFeatSumm.getNumNegative()+1);
            tempFeatSumm.getNegReviews().add(sentenceWithFeats.getSentence());
          }
          else if(valueSenti.equals(Sentiment.Neutral))
          {
            tempFeatSumm.setNumNeutral(tempFeatSumm.getNumNeutral()+1);
            tempFeatSumm.getNeutralReviews().add(sentenceWithFeats.getSentence());
          }
         
View Full Code Here

        opts.setPosTag(true);
        opts.setParseRelations(true);
        ParsedData resultData = sParser.parse(Words, opts);
        Word featureWord = new Word(feature);
        int featIndex = Words.indexOf(featureWord);
        Sentiment sentimentResult = Sentiment.Neutral;
        if (!feature.equals("") && featIndex != -1) {
            WordPos theFeature = resultData.getWordByIndex(featIndex);
            return classifyTextByFeatures(resultData, Words, theFeature);
        }
        // sentimentResult = classifyTextByNouns(resultData, Words);
View Full Code Here

    public ArrayList<LinkedHashMap<String, Sentiment>> fillMap() {
        ArrayList<LinkedHashMap<String, Sentiment>> allFeats = new ArrayList<LinkedHashMap<String, Sentiment>>();
        LinkedHashMap<String, Sentiment> sentence = new LinkedHashMap<String, Sentiment>();

        Sentiment s1 = Sentiment.Positive;
        Sentiment s2 = Sentiment.Positive;
        Sentiment s3 = Sentiment.Negative;
        Sentiment s4 = Sentiment.Neutral;

        sentence.put("design", s1);
        sentence.put("focus", s2);
        sentence.put("size", s3);
        sentence.put("clarity", s4);

        allFeats.add(sentence);

        LinkedHashMap<String, Sentiment> sentence1 = new LinkedHashMap<String, Sentiment>();
        Sentiment s11 = Sentiment.Positive;
        Sentiment s12 = Sentiment.Positive;
        Sentiment s13 = Sentiment.Positive;
        Sentiment s14 = Sentiment.Positive;

        sentence1.put("display", s11);
        sentence1.put("sound quality", s12);
        sentence1.put("memory card", s13);
        sentence1.put("elegance", s14);

        allFeats.add(sentence1);

        LinkedHashMap<String, Sentiment> sentence2 = new LinkedHashMap<String, Sentiment>();
        Sentiment s21 = Sentiment.Negative;
        Sentiment s22 = Sentiment.Negative;
        Sentiment s23 = Sentiment.Neutral;


        sentence2.put("graphics card", s21);
        sentence2.put("processor", s22);
        sentence2.put("memory", s23);
View Full Code Here

                // looping thru the hash<feat,senti>
                while (entriesIterator.hasNext()) {
                    currentEntry = entriesIterator.next();
                    String keySentence = currentEntry.getKey();
                    Sentiment valueSenti = currentEntry.getValue();

                    if (summary.containsKey(keySentence)) // update
                    {
                        FeatureSummary tempFeatSumm = summary.get(keySentence);
                        if (valueSenti.equals(Sentiment.Positive)) {
                            tempFeatSumm.setNumPositive(tempFeatSumm.getNumPositive() + 1);
                            tempFeatSumm.getPosReviews().add(sentenceWithFeats.getSentence());
                        } else if (valueSenti.equals(Sentiment.Negative)) {
                            tempFeatSumm.setNumNegative(tempFeatSumm.getNumNegative() + 1);
                            tempFeatSumm.getNegReviews().add(sentenceWithFeats.getSentence());
                        } else if (valueSenti.equals(Sentiment.Neutral)) {
                            tempFeatSumm.setNumNeutral(tempFeatSumm.getNumNeutral() + 1);
                            tempFeatSumm.getNeutralReviews().add(sentenceWithFeats.getSentence());
                        }
                    } else // create new
                    {
                        FeatureSummary tempFeatSumm = new FeatureSummary();

                        if (valueSenti.equals(Sentiment.Positive)) {
                            tempFeatSumm.setNumPositive(tempFeatSumm.getNumPositive() + 1);
                            tempFeatSumm.getPosReviews().add(sentenceWithFeats.getSentence());
                        } else if (valueSenti.equals(Sentiment.Negative)) {
                            tempFeatSumm.setNumNegative(tempFeatSumm.getNumNegative() + 1);
                            tempFeatSumm.getNegReviews().add(sentenceWithFeats.getSentence());
                        } else if (valueSenti.equals(Sentiment.Neutral)) {
                            tempFeatSumm.setNumNeutral(tempFeatSumm.getNumNeutral() + 1);
                            tempFeatSumm.getNeutralReviews().add(sentenceWithFeats.getSentence());
                        }

                        summary.put(keySentence, tempFeatSumm);
View Full Code Here

                // looping thru the hash<feat,senti>
                while (entriesIterator.hasNext()) {
                    currentEntry = entriesIterator.next();
                    String keySentence = currentEntry.getKey();
                    Sentiment valueSenti = currentEntry.getValue();

                    if (summary.containsKey(keySentence)) // update
                    {
                        FeatureSummary tempFeatSumm = summary.get(keySentence);
                        if (valueSenti.equals(Sentiment.Positive)) {
                            tempFeatSumm.setNumPositive(tempFeatSumm.getNumPositive() + 1);
                            tempFeatSumm.getPosReviews().add(sentenceWithFeats.getSentence());
                        } else if (valueSenti.equals(Sentiment.Negative)) {
                            tempFeatSumm.setNumNegative(tempFeatSumm.getNumNegative() + 1);
                            tempFeatSumm.getNegReviews().add(sentenceWithFeats.getSentence());
                        } else if (valueSenti.equals(Sentiment.Neutral)) {
                            tempFeatSumm.setNumNeutral(tempFeatSumm.getNumNeutral() + 1);
                            tempFeatSumm.getNeutralReviews().add(sentenceWithFeats.getSentence());
                        }
                    } else // create new
                    {
                        FeatureSummary tempFeatSumm = new FeatureSummary();

                        if (valueSenti.equals(Sentiment.Positive)) {
                            tempFeatSumm.setNumPositive(tempFeatSumm.getNumPositive() + 1);
                            tempFeatSumm.getPosReviews().add(sentenceWithFeats.getSentence());
                        } else if (valueSenti.equals(Sentiment.Negative)) {
                            tempFeatSumm.setNumNegative(tempFeatSumm.getNumNegative() + 1);
                            tempFeatSumm.getNegReviews().add(sentenceWithFeats.getSentence());
                        } else if (valueSenti.equals(Sentiment.Neutral)) {
                            tempFeatSumm.setNumNeutral(tempFeatSumm.getNumNeutral() + 1);
                            tempFeatSumm.getNeutralReviews().add(sentenceWithFeats.getSentence());
                        }

                        summary.put(keySentence, tempFeatSumm);
View Full Code Here

TOP

Related Classes of seekfeel.miners.Sentiment

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.