Update util.py
Browse files
util.py
CHANGED
|
@@ -17,7 +17,7 @@ def get_questions(file_path, level):
|
|
| 17 |
def is_ext(file_path, ext):
|
| 18 |
return os.path.splitext(file_path)[1].lower() == ext.lower()
|
| 19 |
|
| 20 |
-
def
|
| 21 |
ext = os.path.splitext(file_path)[1].lower()
|
| 22 |
|
| 23 |
df = None
|
|
@@ -31,7 +31,7 @@ def read_file(file_path):
|
|
| 31 |
|
| 32 |
return "" if df is None else df.to_json()
|
| 33 |
|
| 34 |
-
def
|
| 35 |
doc = Document(file_path)
|
| 36 |
|
| 37 |
text = []
|
|
@@ -55,7 +55,7 @@ def read_docx(file_path):
|
|
| 55 |
|
| 56 |
return "\n".join(text)
|
| 57 |
|
| 58 |
-
def
|
| 59 |
prs = Presentation(file_path)
|
| 60 |
|
| 61 |
text = []
|
|
|
|
| 17 |
def is_ext(file_path, ext):
|
| 18 |
return os.path.splitext(file_path)[1].lower() == ext.lower()
|
| 19 |
|
| 20 |
+
def read_file_json(file_path):
|
| 21 |
ext = os.path.splitext(file_path)[1].lower()
|
| 22 |
|
| 23 |
df = None
|
|
|
|
| 31 |
|
| 32 |
return "" if df is None else df.to_json()
|
| 33 |
|
| 34 |
+
def read_docx_text(file_path):
|
| 35 |
doc = Document(file_path)
|
| 36 |
|
| 37 |
text = []
|
|
|
|
| 55 |
|
| 56 |
return "\n".join(text)
|
| 57 |
|
| 58 |
+
def read_pptx_text(file_path):
|
| 59 |
prs = Presentation(file_path)
|
| 60 |
|
| 61 |
text = []
|