Spaces:
Runtime error
Runtime error
fix indentation error
Browse files
app.py
CHANGED
|
@@ -188,30 +188,29 @@ def is_complex_sentence(sentence):
|
|
| 188 |
return False
|
| 189 |
|
| 190 |
def get_complex_sentences(elements):
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
return ""
|
| 215 |
|
| 216 |
# #####################################
|
| 217 |
|
|
|
|
| 188 |
return False
|
| 189 |
|
| 190 |
def get_complex_sentences(elements):
|
| 191 |
+
|
| 192 |
+
complex_sentences = []
|
| 193 |
+
|
| 194 |
+
for key, value in elements.items():
|
| 195 |
+
for i in range(0, len(elements[key])):
|
| 196 |
+
if is_complex_sentence(elements[key][i]):
|
| 197 |
+
complex_sentences.append(elements[key][i])
|
| 198 |
+
|
| 199 |
+
if complex_sentences:
|
| 200 |
+
output = ""
|
| 201 |
+
for complex_sentence in complex_sentences:
|
| 202 |
+
refactored_element = prompt(
|
| 203 |
+
'''
|
| 204 |
+
You are a specialist in English linguistics.
|
| 205 |
+
A complex sentence is a sentence with one independent clause and at least one dependent clause. A simple sentence has a single independent clause.
|
| 206 |
+
You will be provided with a complex sentence, and your task is to make it a simple sentence.
|
| 207 |
+
Do not convert a verb phrase to a noun phrase, and vice versa.
|
| 208 |
+
Answer with the new sentence only.
|
| 209 |
+
''', complex_sentence)
|
| 210 |
+
output = output + '"' + complex_sentence + '" should be refactored to "' + refactored_element + '"\n'
|
| 211 |
+
return "Complex elements:\n" + output
|
| 212 |
+
else:
|
| 213 |
+
return ""
|
|
|
|
| 214 |
|
| 215 |
# #####################################
|
| 216 |
|