Spaces:
Paused
Paused
Commit
•
00d89f2
1
Parent(s):
ea58a70
just skip over the ones that are good for now
Browse files- chatgpt_audit2.py +45 -31
chatgpt_audit2.py
CHANGED
@@ -88,7 +88,13 @@ for row in results:
|
|
88 |
|
89 |
mapping = similarity_fast.find_most_similar_word(input_word)
|
90 |
|
91 |
-
if mapping['dictionary_word']
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
print(f"Updating: '{input_word}' to '{mapping['dictionary_word']}'")
|
93 |
confirm = input(f"Press 'y' to confirm. Any other key to skip")
|
94 |
if confirm.lower() == 'y':
|
@@ -104,36 +110,44 @@ for row in results:
|
|
104 |
|
105 |
response = query_gpt(input_word, dictionary_word, similar_words_list)
|
106 |
if response:
|
107 |
-
if response in dictionary
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
|
138 |
|
139 |
db_conn.close()
|
|
|
88 |
|
89 |
mapping = similarity_fast.find_most_similar_word(input_word)
|
90 |
|
91 |
+
if mapping['dictionary_word'] == dictionary_word:
|
92 |
+
print(" -> Correct")
|
93 |
+
db_cursor.execute("UPDATE mappings SET reviewed = true WHERE input_word = %s", (input_word,))
|
94 |
+
elif mapping['dictionary_word'] != dictionary_word:
|
95 |
+
# temp stopgap
|
96 |
+
continue
|
97 |
+
|
98 |
print(f"Updating: '{input_word}' to '{mapping['dictionary_word']}'")
|
99 |
confirm = input(f"Press 'y' to confirm. Any other key to skip")
|
100 |
if confirm.lower() == 'y':
|
|
|
110 |
|
111 |
response = query_gpt(input_word, dictionary_word, similar_words_list)
|
112 |
if response:
|
113 |
+
if response in dictionary:
|
114 |
+
if response == dictionary_word:
|
115 |
+
print(" -> Correct")
|
116 |
+
db_cursor.execute("UPDATE mappings SET reviewed = true WHERE input_word = %s", (input_word,))
|
117 |
+
db_conn.commit()
|
118 |
+
elif response != dictionary_word:
|
119 |
+
# temp stopgap
|
120 |
+
continue
|
121 |
+
|
122 |
+
print(f"Updating: '{input_word}' to '{response}'")
|
123 |
+
confirm = input("Press 'y' to confirm, 'i' to ignore, 'd' to delete, 'm' for mixture, any other key to skip: ")
|
124 |
+
if confirm.lower() == 'y':
|
125 |
+
if response == 'Non-Food Item':
|
126 |
+
sql = "UPDATE mappings SET dictionary_word = %s, is_food = FALSE, reviewed = true WHERE input_word = %s"
|
127 |
+
else:
|
128 |
+
sql = "UPDATE mappings SET dictionary_word = %s, reviewed = true, is_food = true WHERE input_word = %s"
|
129 |
+
|
130 |
+
print(f" - Updating mapping with {response}")
|
131 |
+
db_cursor.execute(sql, (response, input_word))
|
132 |
+
db_conn.commit()
|
133 |
+
elif confirm.lower() == 'i':
|
134 |
+
print(f" - Ignoring mapping")
|
135 |
+
sql = "UPDATE mappings SET ignore = true, reviewed = true WHERE input_word = %s"
|
136 |
+
db_cursor.execute(sql, (input_word,))
|
137 |
+
db_conn.commit()
|
138 |
+
elif confirm.lower() == 'd':
|
139 |
+
print(f" - Deleting mapping")
|
140 |
+
sql = "DELETE FROM mappings WHERE input_word = %s"
|
141 |
+
db_cursor.execute(sql, (input_word,))
|
142 |
+
db_conn.commit()
|
143 |
+
elif confirm.lower() == 'm':
|
144 |
+
print(f" - Mixed food items")
|
145 |
+
sql = "UPDATE mappings SET reviewed = true, dictionary_word = 'Mixed Food Items', is_food = true WHERE input_word = %s"
|
146 |
+
db_cursor.execute(sql, (input_word,))
|
147 |
+
db_conn.commit()
|
148 |
+
else:
|
149 |
+
db_cursor.execute("UPDATE mappings SET reviewed = true WHERE input_word = %s", (input_word,))
|
150 |
+
db_conn.commit()
|
151 |
|
152 |
|
153 |
db_conn.close()
|