PgsFile 0.4.1__py3-none-any.whl → 0.4.2__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.
Potentially problematic release.
This version of PgsFile might be problematic. Click here for more details.
- PgsFile/PgsFile.py +27 -1
- PgsFile/__init__.py +1 -0
- PgsFile/models/NLPIR.user +0 -0
- PgsFile/models/prompts/4. OCR prompt.txt +1 -0
- {PgsFile-0.4.1.dist-info → PgsFile-0.4.2.dist-info}/METADATA +4 -4
- {PgsFile-0.4.1.dist-info → PgsFile-0.4.2.dist-info}/RECORD +9 -8
- {PgsFile-0.4.1.dist-info → PgsFile-0.4.2.dist-info}/LICENSE +0 -0
- {PgsFile-0.4.1.dist-info → PgsFile-0.4.2.dist-info}/WHEEL +0 -0
- {PgsFile-0.4.1.dist-info → PgsFile-0.4.2.dist-info}/top_level.txt +0 -0
PgsFile/PgsFile.py
CHANGED
|
@@ -4000,4 +4000,30 @@ def resize_image(input_image_path, output_image_path, max_size_kb):
|
|
|
4000
4000
|
if size <= max_size_kb:
|
|
4001
4001
|
print(f"Image resized successfully to {size} KB.")
|
|
4002
4002
|
else:
|
|
4003
|
-
print("Could not reduce the image size below 2MB.")
|
|
4003
|
+
print("Could not reduce the image size below 2MB.")
|
|
4004
|
+
|
|
4005
|
+
import base64
|
|
4006
|
+
def convert_image_to_url(image_path: str) -> str:
|
|
4007
|
+
"""
|
|
4008
|
+
Convert an image file to a base64 encoded URL format.
|
|
4009
|
+
|
|
4010
|
+
:param image_path: Path to the image file.
|
|
4011
|
+
:return: A string representing the image in the required URL format.
|
|
4012
|
+
"""
|
|
4013
|
+
# Check if the file exists
|
|
4014
|
+
if not os.path.isfile(image_path):
|
|
4015
|
+
raise FileNotFoundError(f"The file {image_path} does not exist.")
|
|
4016
|
+
|
|
4017
|
+
# Open and read the image file in binary mode
|
|
4018
|
+
with open(image_path, "rb") as f:
|
|
4019
|
+
image_data = f.read()
|
|
4020
|
+
|
|
4021
|
+
# Extract the file extension and convert it to base64
|
|
4022
|
+
file_extension = os.path.splitext(image_path)[1][1:]
|
|
4023
|
+
base64_image_data = base64.b64encode(image_data).decode('utf-8')
|
|
4024
|
+
|
|
4025
|
+
# Create the image URL
|
|
4026
|
+
image_url = f"data:image/{file_extension};base64,{base64_image_data}"
|
|
4027
|
+
|
|
4028
|
+
return image_url
|
|
4029
|
+
|
PgsFile/__init__.py
CHANGED
|
@@ -64,5 +64,6 @@ from .PgsFile import timeit
|
|
|
64
64
|
from .PgsFile import replace_white_with_transparency
|
|
65
65
|
from .PgsFile import simhei_default_font_path_MacOS_Windows
|
|
66
66
|
from .PgsFile import get_font_path, resize_image
|
|
67
|
+
from .PgsFile import convert_image_to_url
|
|
67
68
|
|
|
68
69
|
name = "PgsFile"
|
PgsFile/models/NLPIR.user
CHANGED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Perform OCR on the image and return all the extracted text, including both running paragraphs and tables, without any additional explanation. Ensure that tables are kept in their raw format as accurately as possible, without any content or arrangement changes.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PgsFile
|
|
3
|
-
Version: 0.4.
|
|
4
|
-
Summary: This module simplifies Python package management, script execution, file handling, web scraping, and multimedia downloads. The module supports (LLM-based) NLP tasks such as tokenization, lemmatization, POS tagging, NER, keywords extraction, dependency parsing, MDD, WSD, LIWC, and MIP analysis. It also generates word lists, and plots data, aiding literary students. Ideal for scraping data, cleaning text, and analyzing language, it offers user-friendly tools to streamline workflows.
|
|
5
|
-
Home-page: https://mp.weixin.qq.com/s/
|
|
3
|
+
Version: 0.4.2
|
|
4
|
+
Summary: This module simplifies Python package management, script execution, file handling, web scraping, and multimedia downloads. The module supports (LLM-based) NLP tasks such as OCR, tokenization, lemmatization, POS tagging, NER, keywords extraction, dependency parsing, MDD, WSD, LIWC, and MIP analysis. It also generates word lists, and plots data, aiding literary students. Ideal for scraping data, cleaning text, and analyzing language, it offers user-friendly tools to streamline workflows.
|
|
5
|
+
Home-page: https://mp.weixin.qq.com/s/lWMkYDWQMjBJNKY2vMYTpw
|
|
6
6
|
Author: Pan Guisheng
|
|
7
7
|
Author-email: 895284504@qq.com
|
|
8
8
|
License: Educational free
|
|
@@ -34,7 +34,7 @@ Key Features:
|
|
|
34
34
|
4. **Data Storage:** Write and append data to text files, Excel, JSON, and JSON lines.
|
|
35
35
|
5. **File and Folder Processing:** Manage file paths, create directories, move or copy files, and search for files with specific keywords.
|
|
36
36
|
6. **Data Cleaning:** Clean text, handle punctuation, remove stopwords, and prepare data for analysis, utilizing valuable corpora and dictionaries such as CET-4/6 vocabulary and BNC-COCA word lists.
|
|
37
|
-
7. **NLP:** Perform word tokenization, lemmatization, POS tagging, NER, dependency parsing, keywords extraction, MDD, WSD, LIWC, and MIP analysis using prepared LLM prompts.
|
|
37
|
+
7. **NLP:** Perform OCR, word tokenization, lemmatization, POS tagging, NER, dependency parsing, keywords extraction, MDD, WSD, LIWC, and MIP analysis using prepared LLM prompts.
|
|
38
38
|
8. **Math Operations:** Format numbers, convert decimals to percentages, and validate data.
|
|
39
39
|
9. **Visualization:** Process images (e.g., make white pixels transparent, resize images) and manage fonts for rendering text.
|
|
40
40
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
PgsFile/PgsFile.py,sha256=
|
|
2
|
-
PgsFile/__init__.py,sha256=
|
|
1
|
+
PgsFile/PgsFile.py,sha256=piiVyMNNZoXLSuxbcg-5wXJYUgnEAirQUs4GEq7Neaw,165583
|
|
2
|
+
PgsFile/__init__.py,sha256=Qg7xt9wR83ySrS8z0Fy6xn5JttDLoEPLIhpnj7sWGdc,3553
|
|
3
3
|
PgsFile/Corpora/Idioms/English_Idioms_8774.txt,sha256=qlsP0yI_XGECBRiPZuLkGZpdasc77sWSKexANu7v8_M,175905
|
|
4
4
|
PgsFile/Corpora/Monolingual/Chinese/People's Daily 20130605/Raw/00000000.txt,sha256=SLGGSMSb7Ff1RoBstsTW3yX2wNZpqEUchFNpcI-mrR4,1513
|
|
5
5
|
PgsFile/Corpora/Monolingual/Chinese/People's Daily 20130605/Raw/00000001.txt,sha256=imOa6UoCOIZoPXT4_HNHgCUJtd4FTIdk2FZNHNBgJyg,3372
|
|
@@ -2571,7 +2571,7 @@ PgsFile/Corpora/Stopwords/turkish.txt,sha256=uGUvjEm2GR8PuVY_JeHNxhD7cWlNlF7vc3V
|
|
|
2571
2571
|
PgsFile/Corpora/Stopwords/ukrainian.txt,sha256=fEzWLTwnWJriILkO-5jSfE2SpqY-GPf_kR4zid3MFUI,4131
|
|
2572
2572
|
PgsFile/Corpora/Stopwords/vietnamese.txt,sha256=88yRtVMaRSFqas1iGGa6kOGDCZTgtzRPmR3q9dHshdc,20485
|
|
2573
2573
|
PgsFile/Corpora/Terminology/Chinese_Thought.json,sha256=CdkuF2wLaDC5V3sRefcU1RZwXm4-wTZ-Qfk8r7gsu8I,2301866
|
|
2574
|
-
PgsFile/models/NLPIR.user,sha256=
|
|
2574
|
+
PgsFile/models/NLPIR.user,sha256=jLOqi6EhYj9p7eGcTWECcmElwsvNWaUBTSkMeBsO_S4,3356
|
|
2575
2575
|
PgsFile/models/model_reviews2.2.bin,sha256=D6uL8KZIxD0rfWjH0kYEb7z_HE4aTJXpj82HzsCOpuk,1943196
|
|
2576
2576
|
PgsFile/models/model_reviews_ReadMe.txt,sha256=Q9uLJwudMmsTKfd11l1tOcIP8lwsemIwnAVJG_3SYjU,11433
|
|
2577
2577
|
PgsFile/models/dics/BNC_COCA_lists.xlsx,sha256=ua5iQzEf5UQpsCezbsliNF6e_PYHIHGSJUjn9MyEEks,1229313
|
|
@@ -2587,8 +2587,9 @@ PgsFile/models/fonts/陆柬之行书字体.ttf,sha256=Zpd4Z7E9w-Qy74yklXHk4vM7HO
|
|
|
2587
2587
|
PgsFile/models/prompts/1. MIP prompt.txt,sha256=4lHlHmleayRytqr1n9jtt6vn1rQvyf4BKeThpbwI8o8,1638
|
|
2588
2588
|
PgsFile/models/prompts/2. WSD prompt.txt,sha256=o-ZFtCRUCDrXgm040WTQch9v2Y_r2SIlrZaquilJjgQ,2348
|
|
2589
2589
|
PgsFile/models/prompts/3. ICTCLAS Prompt.txt,sha256=VFn6N_JViAbyy9NazA8gjX6SGo5mgBcZOf95aC9JB84,592
|
|
2590
|
-
PgsFile
|
|
2591
|
-
PgsFile-0.4.
|
|
2592
|
-
PgsFile-0.4.
|
|
2593
|
-
PgsFile-0.4.
|
|
2594
|
-
PgsFile-0.4.
|
|
2590
|
+
PgsFile/models/prompts/4. OCR prompt.txt,sha256=YxUQ2IlE52k0fcBnGsuOHqWAmfiEmIu6iRz5zecQ8dk,260
|
|
2591
|
+
PgsFile-0.4.2.dist-info/LICENSE,sha256=cE5c-QToSkG1KTUsU8drQXz1vG0EbJWuU4ybHTRb5SE,1138
|
|
2592
|
+
PgsFile-0.4.2.dist-info/METADATA,sha256=ETpekk4cnT1bC3ZCTlCT7U7mldyOUNO1AW73-L1CUZw,2967
|
|
2593
|
+
PgsFile-0.4.2.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
|
2594
|
+
PgsFile-0.4.2.dist-info/top_level.txt,sha256=028hCfwhF3UpfD6X0rwtWpXI1RKSTeZ1ALwagWaSmX8,8
|
|
2595
|
+
PgsFile-0.4.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|