backup
Browse files- app.py +11 -10
- search_errors_logic.py +0 -1
app.py
CHANGED
@@ -32,17 +32,17 @@ def load_assets():
|
|
32 |
return tool
|
33 |
|
34 |
|
35 |
-
# def extract_text_from_docx(file):
|
36 |
-
# doc = docx.Document(BytesIO(file.getvalue()))
|
37 |
-
# full_text = []
|
38 |
-
# for para in doc.paragraphs:
|
39 |
-
# full_text.append(para.text)
|
40 |
-
# return "\n".join(full_text)
|
41 |
def extract_text_from_docx(file):
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
|
48 |
def main():
|
@@ -106,6 +106,7 @@ def main():
|
|
106 |
st.warning("Введите текст для проверки")
|
107 |
else:
|
108 |
text, errors = check_text(text, tool, mode="chat_gpt", highlight_mode=True)
|
|
|
109 |
if not errors:
|
110 |
st.success("Ошибок не найдено.")
|
111 |
else:
|
|
|
32 |
return tool
|
33 |
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
def extract_text_from_docx(file):
|
36 |
+
doc = docx.Document(BytesIO(file.getvalue()))
|
37 |
+
full_text = []
|
38 |
+
for para in doc.paragraphs:
|
39 |
+
full_text.append(para.text)
|
40 |
+
return "\n".join(full_text)
|
41 |
+
# def extract_text_from_docx(file):
|
42 |
+
# text = mammoth.convert_to_markdown(file).value
|
43 |
+
# for symbol in ".,!?()[]:;":
|
44 |
+
# text = text.replace(f"\{symbol}", symbol)
|
45 |
+
# return text
|
46 |
|
47 |
|
48 |
def main():
|
|
|
106 |
st.warning("Введите текст для проверки")
|
107 |
else:
|
108 |
text, errors = check_text(text, tool, mode="chat_gpt", highlight_mode=True)
|
109 |
+
text = text.replace("\n", " ")
|
110 |
if not errors:
|
111 |
st.success("Ошибок не найдено.")
|
112 |
else:
|
search_errors_logic.py
CHANGED
@@ -207,7 +207,6 @@ def add_comments_to_text(text, errors, add_errors=False):
|
|
207 |
shift += len(inp)
|
208 |
|
209 |
return text
|
210 |
-
#return text.replace("\n", " ")
|
211 |
|
212 |
|
213 |
def check_text(text, tool, mode="chat_gpt", highlight_mode=False, add_errors=False):
|
|
|
207 |
shift += len(inp)
|
208 |
|
209 |
return text
|
|
|
210 |
|
211 |
|
212 |
def check_text(text, tool, mode="chat_gpt", highlight_mode=False, add_errors=False):
|