Package seekfeel.ui

Examples of seekfeel.ui.FeatureSummary


      fSentences.addAll(getFeaturedSentences(tempReview, finalFeatures));
    }
    // /////////////////////// sentiment analysis goes here ...............
    ArrayList<LinkedHashMap<String, Sentiment>> featsSentiment = new ArrayList<LinkedHashMap<String, Sentiment>>();
    LinkedHashMap<String, FeatureSummary> summary = new LinkedHashMap<String, FeatureSummary>();
    FeatureSummary fs = new FeatureSummary();
   
    for (featuredSentence sentenceWithFeats : fSentences)
    {          
      featsSentiment.add(sentimizer.classifyText(sentenceWithFeats.getSentence(),sentenceWithFeats.getFeatures()));
      LinkedHashMap<String, Sentiment> sentenceSentimized = sentimizer.classifyText(sentenceWithFeats.getSentence(),sentenceWithFeats.getFeatures());
     
      Iterator<java.util.Map.Entry<String, Sentiment>> entriesIterator = sentenceSentimized.entrySet().iterator();
      java.util.Map.Entry<String, Sentiment> currentEntry;
     
      // 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.ui.FeatureSummary

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.