The name of the python file that has all the codes to the required tasks is tweetReader.py. The additional files that will be required in order to support this program file are follows.txt and stream.txt.
The program makes use of the object oriented programming to instantiate each tweeting entity. Classes were used to generalize this objects under one banner, and each object was stored inside a list of similar objects.
The task 1 of the program made use of the following class objects in order to identify all the members of the twitter society that were presented in the follows.txt file. Then, the program counts the3 maximum number of followings that a member has and prints the name. In order to display the names of every member in case of a tie, the program appends the names to another list and display it in lexicographical manner using the sort mechanism.
Task 2 expected to extract the name of members, who made the most number of tweets. In order to do this, all tweets from the stream.txt file was imported into the program and stored into the allTweets object list as new objects. Each object had unique member names and all their tweets from different lines of the file were coupled into single respective objects. These objects were then counted for the specification, then sorted and displayed accordingly.
Similarly, Task 3 too used the allTweets list to calculate the members with the most number of retweets.
Finally, for task 4, the allTweets list was yet again searched for, but this time with keen details to string manipulation techniques. It was made sure that the program was able to sort out the names of all mentions with a ‘@’ symbol from among all the tweets. Furthermore, the program also made sure that the mentioned names were properly extracted out of the tweets keeping in mind the next line characters and punctuations.
The program seems to work pretty fine with the test set of data that has been provided. It adheres to almost all the requirements of the program and produces the perfect output, as per expectation. The screenshot of execution has been presented below. This testing has been done by making varying changes to the follows.txt and stream.txt files, in order to test the program’s vitality.