You can get tweet contents and then split them into words. After that you can get average word count by counting the words and dividing it to tweet count.
This code may help you to achieve that logic:
public class Solution {
public static void main(String args[]) {
Solution.printAverageWordCount();
}
public static void printAverageWordCount(){
Query query = new Query("");
query.setCount(100);
query.setResultType(Query.RECENT);
int statusLimit = 5;
int wordCount = 0;
int tweetCount;
do {
QueryResult result = twitter.search(query);
statuses = result.getTweets();
System.out.prinln("Fetch " + statuses.size() + " statuses. Completed in: " + result.getCompletedIn());
tweetCount = 0;
for (Status status : statuses) {
wordCount += status.getText().split("\\s+").length;
tweetCount++;
if(tweetCount >= statusLimit) {
break;
}
}
query = result.nextQuery();
} while (tweetCount < statusLimit);
// calculate average
double average = wordCount/(double)tweetCount;
System.out.println(average);
}
}