Can preprocessing of documents be saved as text file to be read back in? #1919
-
Hi, I am following this tutorial. Under the 'Preprocessing of Documents' section, there are some functions to clean documents and write them into a document store. Instead of writing the cleaned document text data to document store, can I write the cleaned as dictionary object to text file and read that file into memory? If yes, what is the best format to write the data JSON/dictionary? Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @asharm0662! The import json
with open(FILE_NAME, "w") as json_file:
json.dump(dicts, json_file) |
Beta Was this translation helpful? Give feedback.
Hi @asharm0662! The
convert_files_to_dicts
method in the tutorial you linked will return a list of dictionaries. You can easily save them as a json-file like this: