Hi,
I'm trying to search a word on twitter and then pick out keywords within the tweets. For example, searching for 'weather' on Twitter and then adding up how many times people mentioned 'sun', 'rain' etc.
I'm unsure how to scan and add-up the words. Code so far below. Thanks.
- twitter4j.Twitter twitter;
- void setup() {
- twitter = new TwitterFactory().getInstance();
- try {
- Query query = new Query("weather");
- QueryResult result = twitter.search(query);
- List<Tweet> tweets = result.getTweets();
- for (Tweet tweet : tweets) {
- println(tweet.getText());
- }
- } catch (TwitterException te) {
- te.printStackTrace();
- println("Failed to search tweets: " + te.getMessage());
- }
- }
- void draw() {
- }
1