Update app.py
Browse files
app.py
CHANGED
@@ -19,13 +19,15 @@ def extract_sentences_from_excel(file):
|
|
19 |
sentences = [s.strip() for s in sentences if s.strip() and s.strip() != 'nan']
|
20 |
return sentences
|
21 |
|
|
|
|
|
22 |
def save_to_json(data, filename="synthetic_data.json"):
|
23 |
with open(filename, mode='w', encoding='utf-8') as file:
|
24 |
json_data = []
|
25 |
for item in data:
|
26 |
generated_sentences = []
|
27 |
confidence_scores = []
|
28 |
-
for match in re.finditer(r"{'generated_sentence': '(
|
29 |
generated_sentences.append(match.group(1))
|
30 |
confidence_scores.append(float(match.group(2)))
|
31 |
json_data.append({
|
|
|
19 |
sentences = [s.strip() for s in sentences if s.strip() and s.strip() != 'nan']
|
20 |
return sentences
|
21 |
|
22 |
+
import re
|
23 |
+
|
24 |
def save_to_json(data, filename="synthetic_data.json"):
|
25 |
with open(filename, mode='w', encoding='utf-8') as file:
|
26 |
json_data = []
|
27 |
for item in data:
|
28 |
generated_sentences = []
|
29 |
confidence_scores = []
|
30 |
+
for match in re.finditer(r"{'generated_sentence': '(.+?)', 'confidence_score': ([\d\.]+)}", item['generated_data']):
|
31 |
generated_sentences.append(match.group(1))
|
32 |
confidence_scores.append(float(match.group(2)))
|
33 |
json_data.append({
|