(library_name, folder="Agreements")
| 27 | |
| 28 | |
| 29 | def build_lib (library_name, folder="Agreements"): |
| 30 | |
| 31 | # Step 1 - Create library which is the main 'organizing construct' in llmware |
| 32 | print ("\nupdate: Step 1 - Creating library: {}".format(library_name)) |
| 33 | |
| 34 | library = Library().create_new_library(library_name) |
| 35 | |
| 36 | # Step 2 - Pull down the sample files from S3 through the .load_sample_files() command |
| 37 | # --note: if you need to refresh the sample files, set 'over_write=True' |
| 38 | print ("update: Step 2 - Downloading Sample Files") |
| 39 | |
| 40 | sample_files_path = Setup().load_sample_files(over_write=False) |
| 41 | |
| 42 | # Step 3 - point ".add_files" method to the folder of documents that was just created |
| 43 | # this method parses the documents, text chunks, and captures in MongoDB |
| 44 | print("update: Step 3 - Parsing and Text Indexing Files") |
| 45 | |
| 46 | # options: Agreements | UN-Resolutions-500 |
| 47 | library.add_files(input_folder_path=os.path.join(sample_files_path, folder)) |
| 48 | |
| 49 | return library |
| 50 | |
| 51 | |
| 52 | # start script |
no test coverage detected