This commit is contained in:
yumoqing 2025-05-23 18:13:26 +08:00
parent 70fa63b785
commit 61fddf4bd9
4 changed files with 32 additions and 65 deletions

View File

@ -169,9 +169,12 @@ def fileloader(file_path):
if __name__ == '__main__':
import sys
from appPublic.textsplit import split_text_with_dialog_preserved
if len(sys.argv) < 2:
print(f'{sys.argv[0]} file\nload a file and get its text')
sys.exit(1)
text = fileloader(sys.argv[1])
print(f'{text}')
txtlst = split_text_with_dialog_preserved(text)
for txt in txtlst:
print(f'{txt}')

28
pyproject.toml Normal file
View File

@ -0,0 +1,28 @@
[project]
name="file2text"
version = "0.0.1"
description = "load documents from file and get it's text"
authors = [{ name = "yu moqing", email = "yumoqing@gmail.com" }]
readme = "README.md"
requires-python = ">=3.8"
license = {text = "MIT"}
dependencies = [
"langchain_community",
"pillow",
"mobi",
"html2text",
"python-docx",
"python-pptx",
"openpyxl",
"pypdf",
"ebooklib ",
"beautifulsoup4",
]
[project.optional-dependencies]
dev = ["pytest", "black", "mypy"]
[build-system]
requires = ["setuptools>=61", "wheel"]
build-backend = "setuptools.build_meta"

View File

@ -1,12 +0,0 @@
langchain_community
unstructured
pillow
mobi
html2text
python-docx
python-pptx
openpyxl
pypdf
ebooklib
beautifulsoup4

View File

@ -1,52 +0,0 @@
# -*- coding: utf-8 -*-
from file2text.version import __version__
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
required = []
with open('requirements.txt', 'r') as f:
ls = f.read()
required = ls.split('\n')
with open('file2text/version.py', 'r') as f:
x = f.read()
y = x[x.index("'")+1:]
z = y[:y.index("'")]
version = z
with open("README.md", "r") as fh:
long_description = fh.read()
name = "file2text"
description = "file2text"
author = "yumoqing"
email = "yumoqing@gmail.com"
package_data = {}
setup(
name="file2text",
version=version,
# uncomment the following lines if you fill them out in release.py
description=description,
author=author,
author_email=email,
platforms='any',
install_requires=required ,
packages=[
"file2text"
],
package_data=package_data,
keywords = [
],
url="https://github.com/yumoqing/file2text",
long_description=long_description,
long_description_content_type="text/markdown",
classifiers = [
'Operating System :: OS Independent',
'Programming Language :: Python :: 3',
'License :: OSI Approved :: MIT License',
],
)