Esempio n. 1
0
    def visualise_days(self):
        """Visualise data by day of the week."""
        data_parse = Parse()
        data_file = data_parse.main()
        # Returns a dict where it sums the total values for each key.
        # In this case, the keys are the DaysOfWeek, and the values are
        # a count of incidents.
        counter = Counter(item["DayOfWeek"] for item in data_file)

        # Separate out the counter to order it correctly when plotting.
        data_list = [counter["Monday"],
                     counter["Tuesday"],
                     counter["Wednesday"],
                     counter["Thursday"],
                     counter["Friday"],
                     counter["Saturday"],
                     counter["Sunday"]
                     ]

        day_tuple = tuple(["Mon", "Tues", "Wed", "Thurs", "Fri", "Sat", "Sun"])

        # Assign the data to a plot
        plt.plot(data_list)

        # Assign labels to the plot
        plt.xticks(range(len(day_tuple)), day_tuple)

        # Save the plot!
        plt.savefig("Days.png")

        # Close figure
        plt.clf()
Esempio n. 2
0
 def main(self, k):
     binary_questions = []
     sentences_top_k = Parse.main(k)
     for si in sentences_top_k:
         si_pt = Parse.parse(si)
         bin_attemp = self.bin_question_extract(si_pt)
         if bin_attemp:
             binary_questions.append(bin_attemp)
     for q in binary_questions:
         print(q)
Esempio n. 3
0
    def main(self):
        main_parse = Parse()
        data = main_parse.main()

        return self.create_map(data)
Esempio n. 4
0
    def main(self):
        main_parse = Parse()
        data = main_parse.main()

        return self.create_map(data)