PgsFile 0.5.2__py3-none-any.whl → 0.5.3__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 +41 -0
- PgsFile/__init__.py +1 -0
- {PgsFile-0.5.2.dist-info → pgsfile-0.5.3.dist-info}/METADATA +28 -6
- {PgsFile-0.5.2.dist-info → pgsfile-0.5.3.dist-info}/RECORD +7 -7
- {PgsFile-0.5.2.dist-info → pgsfile-0.5.3.dist-info}/WHEEL +1 -1
- {PgsFile-0.5.2.dist-info → pgsfile-0.5.3.dist-info/licenses}/LICENSE +0 -0
- {PgsFile-0.5.2.dist-info → pgsfile-0.5.3.dist-info}/top_level.txt +0 -0
PgsFile/PgsFile.py
CHANGED
|
@@ -4281,3 +4281,44 @@ def maketmx(
|
|
|
4281
4281
|
with open(tmx_path, 'w', encoding='utf-8') as f:
|
|
4282
4282
|
doc.writexml(f, indent='\t', newl='\n', addindent='\t')
|
|
4283
4283
|
|
|
4284
|
+
raw_translation_prompts = {
|
|
4285
|
+
"general": {
|
|
4286
|
+
"basic": "Act as a professional Chinese–English translator specializing in finance and economics. Translate the following text: {text}",
|
|
4287
|
+
"formal_report": "Translate the following Chinese text into English, targeting an international audience with a formal tone suitable for a financial report: {text}",
|
|
4288
|
+
"social_media": "Translate the following Chinese text into English, keeping a friendly and approachable tone suitable for social media content about finance: {text}",
|
|
4289
|
+
},
|
|
4290
|
+
"technical": {
|
|
4291
|
+
"regulation": "Translate the following Chinese financial regulation into English, using terminology consistent with the People’s Bank of China (PBC) and international financial standards. Maintain a formal tone: {text}",
|
|
4292
|
+
"contract": "Translate the following Chinese financial contract into English, ensuring consistency with financial and legal terminology, particularly in capital markets: {text}",
|
|
4293
|
+
"glossary": "Translate the following Chinese text into English using the attached glossary and reference websites: {glossary}, {urls}. Text: {text}"
|
|
4294
|
+
},
|
|
4295
|
+
"review": {
|
|
4296
|
+
"proofread": "Proofread the following Chinese-to-English machine translation. Correct grammar, syntax, and financial terminology errors, and improve readability while maintaining the original meaning: {text}",
|
|
4297
|
+
"localize": "Review the following Chinese-to-English translation as a native English speaker. Adjust any phrases to ensure they sound natural and localized for an international finance audience: {text}",
|
|
4298
|
+
"back_translate": "Back-translate the following English text into Chinese as literally as possible, without interpreting meaning: {text}"
|
|
4299
|
+
},
|
|
4300
|
+
"creative": {
|
|
4301
|
+
"idiom": "How would an English speaker naturally express the Chinese economic idiom: {text}?",
|
|
4302
|
+
"slogan": "Transcreate the following Chinese financial advertising slogan into English. Maintain its persuasive impact and cultural relevance while keeping it concise and memorable. Provide two versions and explain your choices: {text}"
|
|
4303
|
+
}
|
|
4304
|
+
}
|
|
4305
|
+
|
|
4306
|
+
RESULT_ONLY_NOTE = " Only return the translation result without any further explanations."
|
|
4307
|
+
|
|
4308
|
+
def append_result_only(prompts_dict, note=RESULT_ONLY_NOTE):
|
|
4309
|
+
"""
|
|
4310
|
+
Recursively append the note to all prompt strings in a nested dict.
|
|
4311
|
+
"""
|
|
4312
|
+
updated = {}
|
|
4313
|
+
for key, value in prompts_dict.items():
|
|
4314
|
+
if isinstance(value, dict):
|
|
4315
|
+
updated[key] = append_result_only(value, note)
|
|
4316
|
+
elif isinstance(value, str):
|
|
4317
|
+
updated[key] = value.strip() + note
|
|
4318
|
+
else:
|
|
4319
|
+
updated[key] = value
|
|
4320
|
+
return updated
|
|
4321
|
+
|
|
4322
|
+
# Apply it
|
|
4323
|
+
translation_prompts = append_result_only(raw_translation_prompts)
|
|
4324
|
+
|
PgsFile/__init__.py
CHANGED
|
@@ -55,6 +55,7 @@ from .PgsFile import extract_noun_phrases, get_LLMs_prompt, extract_keywords_en,
|
|
|
55
55
|
from .PgsFile import extract_dependency_relations, extract_dependency_relations_full
|
|
56
56
|
from .PgsFile import predict_category
|
|
57
57
|
from .PgsFile import tfidf_keyword_extraction
|
|
58
|
+
from .PgsFile import translation_prompts
|
|
58
59
|
|
|
59
60
|
# 8. Maths
|
|
60
61
|
from .PgsFile import len_rows, check_empty_cells
|
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: PgsFile
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.3
|
|
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 OCR, tokenization, lemmatization, POS tagging, NER, ATE, dependency parsing, MDD, WSD, LIWC, MIP analysis and Chinese-English sentence alignment. 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Author-email: Pan Guisheng <panguisheng@sufe.edu.cn>
|
|
6
|
+
License: License :: Free For Educational Use
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2021-present, GIIT, Shanghai International Studies University.
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Project-URL: Homepage, https://github.com/Petercusin/PgsFile
|
|
29
|
+
Project-URL: Repository, https://github.com/Petercusin/PgsFile
|
|
9
30
|
Classifier: Programming Language :: Python :: 3
|
|
10
31
|
Classifier: License :: Free For Educational Use
|
|
11
32
|
Classifier: Operating System :: OS Independent
|
|
@@ -24,6 +45,7 @@ Requires-Dist: pysbd
|
|
|
24
45
|
Requires-Dist: nlpir-python
|
|
25
46
|
Requires-Dist: pillow
|
|
26
47
|
Requires-Dist: liwc
|
|
48
|
+
Dynamic: license-file
|
|
27
49
|
|
|
28
50
|
Purpose: This module is designed to make complex tasks accessible and convenient, even for beginners. By providing a unified set of tools, it simplifies the workflow for data collection, processing, and analysis. Whether you're scraping data from the web, cleaning text, or performing LLM-based NLP tasks, this module ensures you can focus on your research without getting bogged down by technical challenges.
|
|
29
51
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
PgsFile/PgsFile.py,sha256=
|
|
2
|
-
PgsFile/__init__.py,sha256=
|
|
1
|
+
PgsFile/PgsFile.py,sha256=5YZph6RctA_9n4xRvsXqBIVzF70Z0sB126o-dsMYqeU,177437
|
|
2
|
+
PgsFile/__init__.py,sha256=C9Og4ITZ_AGJ4APkmzkYvv75v0mePBppw984skOZSq0,3746
|
|
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
|
|
@@ -2593,8 +2593,8 @@ PgsFile/models/prompts/5. ATE prompt.txt,sha256=5wu0gGlsV7DI0LruYM3-uAC6brppyYD0
|
|
|
2593
2593
|
PgsFile/models/prompts/6. ATE3 prompt.txt,sha256=VnaXpPa6BgZHUcm8PxmP_qgU-8xEoTB3XcBqjwCUy_g,1254
|
|
2594
2594
|
PgsFile/models/prompts/7. SentAlign prompt.txt,sha256=hXpqqC-CAgo8EytkJ0MaLhevLefALazWriY-ew39jxs,1537
|
|
2595
2595
|
PgsFile/models/prompts/8. TitleCase prompt.txt,sha256=4p-LfGy0xAj2uPi9amyMm41T6Z17VNpFFsGZOgWhROs,1136
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2596
|
+
pgsfile-0.5.3.dist-info/licenses/LICENSE,sha256=cE5c-QToSkG1KTUsU8drQXz1vG0EbJWuU4ybHTRb5SE,1138
|
|
2597
|
+
pgsfile-0.5.3.dist-info/METADATA,sha256=qGxKrMr7r_TWpeWb-slCs7bX95jhwykg5i2nWO_h6tk,4522
|
|
2598
|
+
pgsfile-0.5.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
2599
|
+
pgsfile-0.5.3.dist-info/top_level.txt,sha256=028hCfwhF3UpfD6X0rwtWpXI1RKSTeZ1ALwagWaSmX8,8
|
|
2600
|
+
pgsfile-0.5.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|