/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package at.illecker.storm.examples.util.supervised;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import at.illecker.storm.examples.util.Tweet;
import at.illecker.storm.examples.util.unsupervised.UnsupervisedSentimentAnalysis;

public class SimpleFeatureVectorGenerator implements FeatureVectorGenerator {
  private static final Logger LOG = LoggerFactory
      .getLogger(SimpleFeatureVectorGenerator.class);
  private static final SimpleFeatureVectorGenerator instance = new SimpleFeatureVectorGenerator();
  private UnsupervisedSentimentAnalysis m_unsupervisedSentimentAnalysis;

  private SimpleFeatureVectorGenerator() {
    m_unsupervisedSentimentAnalysis = UnsupervisedSentimentAnalysis
        .getInstance();
  }

  public static SimpleFeatureVectorGenerator getInstance() {
    return instance;
  }

  @Override
  public double[] calculateFeatureVector(Tweet tweet) {
    double tweetSentiment = m_unsupervisedSentimentAnalysis
        .getTweetSentiment(tweet);
    LOG.info("tweetSentiment: " + tweetSentiment);

    return new double[] { tweetSentiment };
  }

  public static List<Tweet> getTestTweets() {
    List<Tweet> tweets = new ArrayList<Tweet>();
    tweets.add(new Tweet(264183816548130816L,
        "Gas by my house hit $3.39 !!!! I'm going to Chapel Hill on Sat . :)",
        1));
    tweets
        .add(new Tweet(
            263398998675693568L,
            "@oluoch @victor_otti @kunjand I just watched it ! Sridevi's comeback .... U remember her from the 90s ?? Sun mornings on NTA ;)",
            1));
    tweets
        .add(new Tweet(
            264259830590603264L,
            "Why is it so hard to find the @TVGuideMagazine these days ? Went to 3 stores for the Castle cover issue . NONE . Will search again tomorrow ...",
            0));
    tweets
        .add(new Tweet(
            259724822978904064L,
            "PBR & @mokbpresents bring you Jim White at the @Do317 Lounge on October 23rd at 7 pm ! http://t.co/7x8OfC56",
            0));
    tweets
        .add(new Tweet(
            243725520724967424L,
            "If you're on the Isle of Man next Thurs , I'll be talking about Safe House and signing books at Waterstones from 6.30 pm . @WaterstonesIoM",
            0));
    tweets
        .add(new Tweet(
            243725520724967424L,
            "If you're on the Isle of Man next Thurs , I'll be talking about Safe House and signing books at Waterstones from 6.30 pm . @WaterstonesIoM",
            0));
    return tweets;
  }

  public static void main(String[] args) {
    List<Tweet> tweets = getTestTweets();

    FeatureVectorGenerator fvg = new SimpleFeatureVectorGenerator();
    for (Tweet tweet : tweets) {
      System.out.println("Tweet: " + tweet);
      System.out.println("FeatureVector: "
          + Arrays.toString(fvg.calculateFeatureVector(tweet)));
    }
  }
}

@@ -1082,17 +1082,72 @@
 ervised.
-U
+util.POSTagger;%0Aimport at.illecker.storm.examples.util.u
 nsupervi
@@ -1141,32 +1141,38 @@
 til.unsupervised
+.util.
 SentimentAnalysi
@@ -1164,24 +1164,134 @@
 entiment
-Analysis
+WordLists;%0Aimport at.illecker.storm.examples.util.unsupervised.util.Tokenizer;%0Aimport edu.stanford.nlp.ling.TaggedWord
 ;%0A%0Apubli
@@ -1580,191 +1580,138 @@
 ate 
-UnsupervisedSentimentAnalysis m_unsupervisedSentimentAnalysis;%0A%0A  private SimpleFeatureVectorGenerator() %7B%0A    m_unsupervisedSentimentAnalysis = UnsupervisedSentimentAnalysis%0A        
+SentimentWordLists m_sentimentWordLists;%0A%0A  private SimpleFeatureVectorGenerator() %7B%0A    m_sentimentWordLists = SentimentWordLists
 .get
@@ -1916,46 +1916,26 @@
 = m_
-unsupervisedSentimentAnalysis%0A        
+sentimentWordLists
 .get
@@ -3524,51 +3524,65 @@
     
-List%3CTweet%3E tweets = getTestTweets
+POSTagger posTagger = POSTagger.getInstance
 ();%0A
-%0A
     
+Simple
 Feat
@@ -3604,17 +3604,14 @@
 tor 
+s
 fvg =
- new
  Sim
@@ -3635,20 +3635,42 @@
 enerator
+%0A        .getInstance
 ();%0A
+%0A
     for 
@@ -3684,22 +3684,31 @@
 tweet : 
-t
+getTestT
 weets
+()
 ) %7B%0A    
@@ -3744,24 +3744,210 @@
 %22 + tweet);%0A
+%0A      List%3CString%3E tokens = Tokenizer.tokenize(tweet.getText());%0A      List%3CTaggedWord%3E taggedSentence = posTagger.tagSentence(tokens);%0A%0A      tweet.addTaggedSentence(taggedSentence);%0A%0A
       System
@@ -4005,16 +4005,17 @@
 oString(
+s
 fvg.calc

Update SimpleFeatureGenerator