| 117 | |
| 118 | #load the pickle file as a dictionary |
| 119 | def loadDictionaryFromPickleFile(dictionaryPath): |
| 120 | print("Loading dictionary at:", dictionaryPath) |
| 121 | if dictionaryPath.rsplit(".")[-1] == "pickle": |
| 122 | filePointer=open(dictionaryPath, 'rb') |
| 123 | dictionary = pickle.load(filePointer) |
| 124 | filePointer.close() |
| 125 | else: |
| 126 | dictionary = bz2.BZ2File(dictionaryPath, "rb") |
| 127 | dictionary = cPickle.load(dictionary) |
| 128 | print("The total number of keys in the dictionary are:", len(dictionary)) |
| 129 | return dictionary |
| 130 | |
| 131 | |
| 132 | #load csv file as a dictionary. Further preprocessing may be required after loading |