pydatamax 0.1.13__py3-none-any.whl → 0.1.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datamax/__init__.py +1 -1
- datamax/loader/core.py +118 -118
- datamax/loader/{MinioHandler.py → minio_handler.py} +171 -171
- datamax/loader/{OssHandler.py → oss_handler.py} +191 -191
- datamax/parser/__init__.py +2 -4
- datamax/parser/base.py +76 -76
- datamax/parser/core.py +406 -288
- datamax/parser/csv_parser.py +31 -10
- datamax/parser/doc_parser.py +525 -61
- datamax/parser/docx_parser.py +512 -62
- datamax/parser/epub_parser.py +41 -41
- datamax/parser/html_parser.py +37 -37
- datamax/parser/image_parser.py +34 -34
- datamax/parser/json_parser.py +32 -10
- datamax/parser/md_parser.py +72 -72
- datamax/parser/pdf_parser.py +101 -101
- datamax/parser/ppt_parser.py +70 -20
- datamax/parser/pptx_parser.py +45 -45
- datamax/parser/txt_parser.py +45 -45
- datamax/parser/xls_parser.py +26 -26
- datamax/parser/xlsx_parser.py +212 -208
- datamax/utils/__init__.py +23 -2
- datamax/utils/constants.py +58 -58
- datamax/utils/data_cleaner.py +275 -237
- datamax/utils/env_setup.py +79 -79
- datamax/utils/gotocr_pdf.py +265 -265
- datamax/utils/mineru_operator.py +62 -62
- datamax/utils/paddleocr_pdf_operator.py +90 -90
- datamax/utils/ppt_extract.py +140 -140
- datamax/utils/qa_generator.py +369 -376
- datamax/utils/tokenizer.py +21 -21
- datamax/utils/uno_handler.py +426 -0
- pydatamax-0.1.15.dist-info/METADATA +340 -0
- pydatamax-0.1.15.dist-info/RECORD +38 -0
- {pydatamax-0.1.13.dist-info → pydatamax-0.1.15.dist-info}/licenses/LICENSE +21 -21
- {pydatamax-0.1.13.dist-info → pydatamax-0.1.15.dist-info}/top_level.txt +0 -1
- pydatamax-0.1.13.dist-info/METADATA +0 -280
- pydatamax-0.1.13.dist-info/RECORD +0 -39
- tests/__init__.py +0 -0
- tests/test_basic.py +0 -20
- {pydatamax-0.1.13.dist-info → pydatamax-0.1.15.dist-info}/WHEEL +0 -0
datamax/parser/csv_parser.py
CHANGED
@@ -1,10 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
import pandas as pd
|
2
|
+
|
3
|
+
from datamax.parser.base import BaseLife, MarkdownOutputVo
|
4
|
+
|
5
|
+
|
6
|
+
class CsvParser(BaseLife):
|
7
|
+
|
8
|
+
def __init__(self, file_path):
|
9
|
+
super().__init__()
|
10
|
+
self.file_path = file_path
|
11
|
+
|
12
|
+
@staticmethod
|
13
|
+
def read_csv_file(file_path: str) -> pd.DataFrame:
|
14
|
+
"""Read a CSV file into a pandas DataFrame."""
|
15
|
+
return pd.read_csv(file_path)
|
16
|
+
|
17
|
+
def parse(self, file_path: str) -> MarkdownOutputVo:
|
18
|
+
try:
|
19
|
+
df = self.read_csv_file(file_path)
|
20
|
+
mk_content = df.to_markdown(index=False)
|
21
|
+
lifecycle = self.generate_lifecycle(
|
22
|
+
source_file=file_path,
|
23
|
+
domain="Technology",
|
24
|
+
usage_purpose="Documentation",
|
25
|
+
life_type="LLM_ORIGIN",
|
26
|
+
)
|
27
|
+
output_vo = MarkdownOutputVo(self.get_file_extension(file_path), mk_content)
|
28
|
+
output_vo.add_lifecycle(lifecycle)
|
29
|
+
return output_vo.to_dict()
|
30
|
+
except Exception as e:
|
31
|
+
raise e
|