(dictionary, dictionaryPath)
| 106 | |
| 107 | #This function saves dictionaries as pickle files in the storage. |
| 108 | def saveDictionaryAsPickleFile(dictionary, dictionaryPath): |
| 109 | if dictionaryPath.rsplit(".")[-1] == "pickle": |
| 110 | filePointer=open(dictionaryPath, 'wb') |
| 111 | pickle.dump(dictionary,filePointer, protocol=pickle.HIGHEST_PROTOCOL) |
| 112 | filePointer.close() |
| 113 | else: |
| 114 | with bz2.BZ2File(dictionaryPath, "w") as f: |
| 115 | cPickle.dump(dictionary, f) |
| 116 | |
| 117 | |
| 118 | #load the pickle file as a dictionary |