LiamDowd commited on
Commit
943ccd0
1 Parent(s): 29831d7

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -7
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")