Update main.py
Browse files
main.py
CHANGED
@@ -46,6 +46,12 @@ def valueInJSON(value, key):
|
|
46 |
except KeyError:
|
47 |
return ""
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
if not os.path.exists(jsonPath):
|
50 |
with open(jsonPath, 'w+') as file:
|
51 |
json.dump({"names": {}, "addresses": {}, "companyNames": {}, "phoneNumbers": {}, "emails": {}}, file, indent=2)
|
@@ -60,13 +66,6 @@ with open('names.txt', 'r') as file:
|
|
60 |
#with open('addresses.txt', 'r') as file:
|
61 |
# addresses = file.read().splitlines()
|
62 |
|
63 |
-
#directory make if not exist
|
64 |
-
os.makedirs(baseFilePath + "documents/", exist_ok=True)
|
65 |
-
os.makedirs(baseFilePath + "text/", exist_ok=True)
|
66 |
-
os.makedirs(baseFilePath + "redacted/", exist_ok=True)
|
67 |
-
os.makedirs(baseFilePath + "chroma_db/", exist_ok=True)
|
68 |
-
os.makedirs(baseFilePath + "keyvalues/", exist_ok=True)
|
69 |
-
|
70 |
def redactDocument(filepath):
|
71 |
#TAKES A DOCUMENT AND REDACTS SENSITIVE INFO SUCH AS NAMES, ADDRESSES, PHONE NUMBERS, EMAILS, ETC.
|
72 |
file = open(filepath, "r")
|
|
|
46 |
except KeyError:
|
47 |
return ""
|
48 |
|
49 |
+
os.makedirs(baseFilePath + "documents/", exist_ok=True)
|
50 |
+
os.makedirs(baseFilePath + "text/", exist_ok=True)
|
51 |
+
os.makedirs(baseFilePath + "redacted/", exist_ok=True)
|
52 |
+
os.makedirs(baseFilePath + "chroma_db/", exist_ok=True)
|
53 |
+
os.makedirs(baseFilePath + "keyvalues/", exist_ok=True)
|
54 |
+
|
55 |
if not os.path.exists(jsonPath):
|
56 |
with open(jsonPath, 'w+') as file:
|
57 |
json.dump({"names": {}, "addresses": {}, "companyNames": {}, "phoneNumbers": {}, "emails": {}}, file, indent=2)
|
|
|
66 |
#with open('addresses.txt', 'r') as file:
|
67 |
# addresses = file.read().splitlines()
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
def redactDocument(filepath):
|
70 |
#TAKES A DOCUMENT AND REDACTS SENSITIVE INFO SUCH AS NAMES, ADDRESSES, PHONE NUMBERS, EMAILS, ETC.
|
71 |
file = open(filepath, "r")
|