Exemplo n.º 1
0
        print(datetime.now().strftime("%H:%M:%S") + ": cache not found")

        # file is not created, scores will be calculated, create a file/cache
        workbook = openpyxl.Workbook()

        # returns a sheet with doc-vectors with doc-tf-idf, df, idf and bag-of-words
        doc_sheet = vsm.create_doc_sheet(workbook.active)

        # saves the cache file on disk
        workbook.save("../out/tf-idf.xlsx")

        print(datetime.now().strftime("%H:%M:%S") + ": cache saved to disk")

    # an object of GUI class is created
    # doc_sheet which have doc-vectors and bag-of-words is passed to the constructor and vsm object
    gui = GUI(vsm, doc_sheet)

    # setGUI creates the GUI and returns a window through which we run the GUI
    window = gui.setGUI()

    # this opens the GUI
    window.mainloop()

    # when GUI window is closed the control comes here

    # closes the workbook that ahs doc-sheet
    workbook.close()

    print(datetime.now().strftime("%H:%M:%S") + ": cache-file closed")
    print(datetime.now().strftime("%H:%M:%S") + ": exit")