polytext 0.2.8b1__tar.gz → 0.2.8b3__tar.gz
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.
- {polytext-0.2.8b1 → polytext-0.2.8b3}/PKG-INFO +1 -1
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/audio_to_text.py +9 -4
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/document_ocr_to_text.py +14 -4
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/ocr_to_text.py +3 -2
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/base.py +17 -6
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/prompts/ocr.py +9 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext.egg-info/PKG-INFO +1 -1
- {polytext-0.2.8b1 → polytext-0.2.8b3}/setup.py +1 -1
- {polytext-0.2.8b1 → polytext-0.2.8b3}/LICENSE +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/README.md +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/__init__.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/__init__.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/base.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/beautiful_text.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/document_ocr_to_text_azure_oai.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/gemini_quality_guards.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/html_to_md.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/md_to_text.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/ocr_to_text_azure_oai.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/pdf.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/text_to_md.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/converter/video_to_audio.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/exceptions/__init__.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/exceptions/base.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/generator/__init__.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/generator/pdf.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/__init__.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/audio.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/aws_auth.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/document.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/document_ocr.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/downloader/__init__.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/downloader/downloader.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/html.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/markdown.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/notebook.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/ocr.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/plain_text.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/video.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/xml_xbrl.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/youtube.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/loader/youtube_llm.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/processor/__init__.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/processor/audio_chunker.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/processor/text_merger.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/processor/transcript_chunker.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/prompts/__init__.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/prompts/beautiful_text.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/prompts/text_merging.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/prompts/text_to_md.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/prompts/transcription.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/utils/__init__.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext/utils/utils.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext.egg-info/SOURCES.txt +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext.egg-info/dependency_links.txt +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext.egg-info/not-zip-safe +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext.egg-info/requires.txt +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/polytext.egg-info/top_level.txt +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/pyproject.toml +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/setup.cfg +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_audio_chunker.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_audio_comparison_helpers.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_audio_transcription_model_migration.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_aws_auth.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_base_loader_error_mapping.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_beautiful_text_manual.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_compare_audio_models.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_compare_document_ocr_to_text_models.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_compare_ocr_to_text_models.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_compare_youtube_models.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_dowload_audio_from_youtube.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_dowload_audio_from_youtube_helpers.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_extracted_text_whitespace.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_gemini_quality_guards.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_get_audio_transcript_from_gcs.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_get_customized_pdf_from_markdown.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_get_document_ocr.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_get_document_ocr_azure_oai.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_get_document_text.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_get_document_text_from_gcs.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_get_ocr_from_image.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_get_text_from_markdown.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_get_video_transcript_from_gcs.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_library.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_markdown_loader_gzip.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_markitdown_html.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_notebook_loader.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_ocr_fallbacks.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_ocr_image_descriptions.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_pain_text.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_pdf_conversion_error.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_python_version_metadata.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_split_audio_with_llm.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_transcribe_s3_images_from_csv.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_transcribe_s3_images_from_csv_script.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_xml_xbrl_loader.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_youtube_gemini_minimal_check.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_youtube_llm_fallbacks.py +0 -0
- {polytext-0.2.8b1 → polytext-0.2.8b3}/tests/test_youtube_transcript.py +0 -0
|
@@ -80,23 +80,30 @@ def add_line_break_after_each_sentence(text: str) -> str:
|
|
|
80
80
|
if not text:
|
|
81
81
|
return text
|
|
82
82
|
|
|
83
|
+
line_feed = chr(10)
|
|
83
84
|
lines = text.splitlines()
|
|
84
85
|
formatted_lines = []
|
|
85
86
|
|
|
86
87
|
for line in lines:
|
|
87
88
|
stripped_line = line.strip()
|
|
89
|
+
|
|
88
90
|
if not stripped_line:
|
|
89
91
|
formatted_lines.append("")
|
|
90
92
|
continue
|
|
93
|
+
|
|
91
94
|
if re.match(r"^#{1,6}\s+", stripped_line):
|
|
92
95
|
formatted_lines.append(stripped_line)
|
|
93
96
|
continue
|
|
94
97
|
|
|
95
98
|
normalized_line = re.sub(r"\s+", " ", stripped_line)
|
|
96
|
-
normalized_line = re.sub(
|
|
99
|
+
normalized_line = re.sub(
|
|
100
|
+
r"([.!?])\s+",
|
|
101
|
+
lambda match: f"{match.group(1)}{line_feed} ",
|
|
102
|
+
normalized_line,
|
|
103
|
+
)
|
|
97
104
|
formatted_lines.append(normalized_line)
|
|
98
105
|
|
|
99
|
-
return
|
|
106
|
+
return line_feed.join(formatted_lines).strip()
|
|
100
107
|
|
|
101
108
|
|
|
102
109
|
def create_ascii_safe_upload_copy(audio_file: str) -> tuple[str, str | None]:
|
|
@@ -537,8 +544,6 @@ class AudioToTextConverter:
|
|
|
537
544
|
)
|
|
538
545
|
|
|
539
546
|
response_text, marker_only = normalize_no_human_speech_marker(response_text)
|
|
540
|
-
if not marker_only:
|
|
541
|
-
response_text = self.format_audio_output_text(response_text)
|
|
542
547
|
|
|
543
548
|
response_dict = {
|
|
544
549
|
"transcript": "" if marker_only else response_text,
|
|
@@ -13,6 +13,7 @@ from google.api_core import exceptions as google_exceptions
|
|
|
13
13
|
from ..prompts.ocr import (
|
|
14
14
|
OCR_TO_MARKDOWN_NON_LITERAL_FALLBACK_PROMPT,
|
|
15
15
|
OCR_TO_MARKDOWN_PROMPT,
|
|
16
|
+
OCR_TO_PLAIN_TEXT_NON_LITERAL_FALLBACK_PROMPT,
|
|
16
17
|
OCR_TO_PLAIN_TEXT_PROMPT,
|
|
17
18
|
build_ocr_prompt,
|
|
18
19
|
)
|
|
@@ -34,7 +35,7 @@ OCR_TAIL_REPETITION_THRESHOLD = float(os.getenv("OCR_TAIL_REPETITION_THRESHOLD",
|
|
|
34
35
|
OCR_FALLBACK_SOURCE_PATTERN = os.getenv("OCR_FALLBACK_SOURCE_PATTERN", "flash-lite-preview")
|
|
35
36
|
OCR_FALLBACK_MODEL = os.getenv("OCR_FALLBACK_MODEL", "gemini-3-flash-preview")
|
|
36
37
|
OCR_FALLBACK_TEMPERATURE = float(os.getenv("OCR_FALLBACK_TEMPERATURE", "1.0"))
|
|
37
|
-
OCR_FINAL_FALLBACK_MODEL = os.getenv("OCR_FINAL_FALLBACK_MODEL", "gemini-3.
|
|
38
|
+
OCR_FINAL_FALLBACK_MODEL = os.getenv("OCR_FINAL_FALLBACK_MODEL", "gemini-3.5-flash")
|
|
38
39
|
OCR_PROMPT_VARIANT_DEFAULT = "default"
|
|
39
40
|
OCR_PROMPT_VARIANT_NON_LITERAL_FALLBACK = "non_literal_fallback"
|
|
40
41
|
OCR_RETRIABLE_OUTPUT_ERROR_CODES = (996, 997, 999)
|
|
@@ -222,6 +223,8 @@ class DocumentOCRToTextConverter:
|
|
|
222
223
|
def _build_prompt_template(self) -> str:
|
|
223
224
|
if self.markdown_output and self.prompt_variant == OCR_PROMPT_VARIANT_NON_LITERAL_FALLBACK:
|
|
224
225
|
base_prompt = OCR_TO_MARKDOWN_NON_LITERAL_FALLBACK_PROMPT
|
|
226
|
+
elif not self.markdown_output and self.prompt_variant == OCR_PROMPT_VARIANT_NON_LITERAL_FALLBACK:
|
|
227
|
+
base_prompt = OCR_TO_PLAIN_TEXT_NON_LITERAL_FALLBACK_PROMPT
|
|
225
228
|
elif self.markdown_output:
|
|
226
229
|
base_prompt = OCR_TO_MARKDOWN_PROMPT
|
|
227
230
|
else:
|
|
@@ -234,8 +237,6 @@ class DocumentOCRToTextConverter:
|
|
|
234
237
|
def should_prompt_fallback_retry(self, error: EmptyDocument) -> bool:
|
|
235
238
|
if self.fallback_stage != 0:
|
|
236
239
|
return False
|
|
237
|
-
if not self.markdown_output:
|
|
238
|
-
return False
|
|
239
240
|
if self.prompt_variant == OCR_PROMPT_VARIANT_NON_LITERAL_FALLBACK:
|
|
240
241
|
return False
|
|
241
242
|
return error.code in OCR_RETRIABLE_OUTPUT_ERROR_CODES
|
|
@@ -570,6 +571,7 @@ class DocumentOCRToTextConverter:
|
|
|
570
571
|
"completion_model_provider": self.ocr_model_provider,
|
|
571
572
|
"text_chunks": "not provided",
|
|
572
573
|
"page_error": True,
|
|
574
|
+
"page_error_reason": error.message,
|
|
573
575
|
}
|
|
574
576
|
return page_num, ocr_result
|
|
575
577
|
|
|
@@ -603,11 +605,17 @@ class DocumentOCRToTextConverter:
|
|
|
603
605
|
all_text = []
|
|
604
606
|
total_completion_tokens = 0
|
|
605
607
|
total_prompt_tokens = 0
|
|
608
|
+
failed_pages = []
|
|
606
609
|
|
|
607
|
-
for
|
|
610
|
+
for page_num, ocr_result in results:
|
|
608
611
|
all_text.append(f"{ocr_result['text']}\n")
|
|
609
612
|
total_completion_tokens += ocr_result['completion_tokens']
|
|
610
613
|
total_prompt_tokens += ocr_result['prompt_tokens']
|
|
614
|
+
if ocr_result.get("page_error"):
|
|
615
|
+
failed_pages.append({
|
|
616
|
+
"page": page_num + 1,
|
|
617
|
+
"reason": ocr_result.get("page_error_reason", "unknown"),
|
|
618
|
+
})
|
|
611
619
|
|
|
612
620
|
pdf.close()
|
|
613
621
|
|
|
@@ -618,6 +626,8 @@ class DocumentOCRToTextConverter:
|
|
|
618
626
|
"completion_model": self.ocr_model,
|
|
619
627
|
"completion_model_provider": self.ocr_model_provider,
|
|
620
628
|
"text_chunks": "not provided",
|
|
629
|
+
"ocr_failed_pages": [item["page"] for item in failed_pages],
|
|
630
|
+
"ocr_failed_pages_detail": failed_pages,
|
|
621
631
|
}
|
|
622
632
|
|
|
623
633
|
return final_result_dict
|
|
@@ -13,6 +13,7 @@ from google.api_core import exceptions as google_exceptions
|
|
|
13
13
|
from ..prompts.ocr import (
|
|
14
14
|
OCR_TO_MARKDOWN_NON_LITERAL_FALLBACK_PROMPT,
|
|
15
15
|
OCR_TO_MARKDOWN_PROMPT,
|
|
16
|
+
OCR_TO_PLAIN_TEXT_NON_LITERAL_FALLBACK_PROMPT,
|
|
16
17
|
OCR_TO_PLAIN_TEXT_PROMPT,
|
|
17
18
|
build_ocr_prompt,
|
|
18
19
|
)
|
|
@@ -207,6 +208,8 @@ class OCRToTextConverter:
|
|
|
207
208
|
def _build_prompt_template(self) -> str:
|
|
208
209
|
if self.markdown_output and self.prompt_variant == OCR_PROMPT_VARIANT_NON_LITERAL_FALLBACK:
|
|
209
210
|
base_prompt = OCR_TO_MARKDOWN_NON_LITERAL_FALLBACK_PROMPT
|
|
211
|
+
elif not self.markdown_output and self.prompt_variant == OCR_PROMPT_VARIANT_NON_LITERAL_FALLBACK:
|
|
212
|
+
base_prompt = OCR_TO_PLAIN_TEXT_NON_LITERAL_FALLBACK_PROMPT
|
|
210
213
|
elif self.markdown_output:
|
|
211
214
|
base_prompt = OCR_TO_MARKDOWN_PROMPT
|
|
212
215
|
else:
|
|
@@ -219,8 +222,6 @@ class OCRToTextConverter:
|
|
|
219
222
|
def should_prompt_fallback_retry(self, error: EmptyDocument) -> bool:
|
|
220
223
|
if self.fallback_stage != 0:
|
|
221
224
|
return False
|
|
222
|
-
if not self.markdown_output:
|
|
223
|
-
return False
|
|
224
225
|
if self.prompt_variant == OCR_PROMPT_VARIANT_NON_LITERAL_FALLBACK:
|
|
225
226
|
return False
|
|
226
227
|
return error.code in OCR_RETRIABLE_OUTPUT_ERROR_CODES
|
|
@@ -416,8 +416,7 @@ class BaseLoader:
|
|
|
416
416
|
if path_without_query:
|
|
417
417
|
_, file_extension = os.path.splitext(path_without_query)
|
|
418
418
|
else: # If is local file path (without schema)
|
|
419
|
-
|
|
420
|
-
_, file_extension = os.path.splitext(input)
|
|
419
|
+
_, file_extension = os.path.splitext(input)
|
|
421
420
|
|
|
422
421
|
if file_extension:
|
|
423
422
|
file_extension = file_extension.lower()
|
|
@@ -447,9 +446,11 @@ class BaseLoader:
|
|
|
447
446
|
)
|
|
448
447
|
elif mime_type:
|
|
449
448
|
if file_extension in [".pdf", ".xlsx", ".docx", ".txt", ".csv", ".odt", ".pptx", ".xls", ".doc", ".ppt", ".rtf"]:
|
|
449
|
+
document_kwargs = {k: v for k, v in kwargs.items() if k != "source"}
|
|
450
450
|
if self.force_ocr:
|
|
451
451
|
|
|
452
452
|
return DocumentOCRLoader(
|
|
453
|
+
source=self.source,
|
|
453
454
|
llm_api_key=llm_api_key,
|
|
454
455
|
markdown_output=self.markdown_output,
|
|
455
456
|
temp_dir=self.temp_dir,
|
|
@@ -458,10 +459,16 @@ class BaseLoader:
|
|
|
458
459
|
ocr_model=self.ocr_model,
|
|
459
460
|
include_image_descriptions=self.include_image_descriptions,
|
|
460
461
|
allow_partial_ocr_failures=True,
|
|
461
|
-
**
|
|
462
|
+
**document_kwargs,
|
|
462
463
|
)
|
|
463
464
|
|
|
464
|
-
return DocumentLoader(
|
|
465
|
+
return DocumentLoader(
|
|
466
|
+
source=self.source,
|
|
467
|
+
markdown_output=self.markdown_output,
|
|
468
|
+
temp_dir=self.temp_dir,
|
|
469
|
+
timeout_minutes=self.timeout_minutes,
|
|
470
|
+
**document_kwargs,
|
|
471
|
+
)
|
|
465
472
|
elif mime_type.startswith("audio/"):
|
|
466
473
|
audio_kwargs = {**kwargs, "is_output_audio_raw": self.is_output_audio_raw}
|
|
467
474
|
return AudioLoader(llm_api_key=llm_api_key, markdown_output=self.markdown_output, temp_dir=self.temp_dir, timeout_minutes=self.timeout_minutes, **audio_kwargs)
|
|
@@ -590,14 +597,18 @@ class BaseLoader:
|
|
|
590
597
|
|
|
591
598
|
result_dict["text"] = clean_extracted_text_whitespace(remove_markdown_strip(result_dict["text"]))
|
|
592
599
|
|
|
593
|
-
|
|
600
|
+
final_result = {
|
|
594
601
|
"text": result_dict["text"],
|
|
595
602
|
"completion_tokens": result_dict["completion_tokens"],
|
|
596
603
|
"prompt_tokens": result_dict["prompt_tokens"],
|
|
597
604
|
"output_list": [result_dict],
|
|
598
605
|
}
|
|
599
606
|
|
|
600
|
-
|
|
607
|
+
for metadata_key in ("ocr_failed_pages", "ocr_failed_pages_detail"):
|
|
608
|
+
if metadata_key in result_dict:
|
|
609
|
+
final_result[metadata_key] = result_dict[metadata_key]
|
|
610
|
+
|
|
611
|
+
return final_result
|
|
601
612
|
|
|
602
613
|
# Helper methods
|
|
603
614
|
@staticmethod
|
|
@@ -28,6 +28,15 @@ Maintain paragraph breaks and formatting.
|
|
|
28
28
|
Your output must be a plain text.
|
|
29
29
|
"""
|
|
30
30
|
|
|
31
|
+
OCR_TO_PLAIN_TEXT_NON_LITERAL_FALLBACK_PROMPT = """
|
|
32
|
+
Rephrase and reorganize the text content in a coherent plain text structure.
|
|
33
|
+
Do not transcribe the text verbatim, but preserve the meaning of the original content without omitting anything, even apparently minor details.
|
|
34
|
+
Pay special attention to tables, columns, headers, and any structured content.
|
|
35
|
+
Maintain paragraph breaks and formatting.
|
|
36
|
+
Your output must be a plain text.
|
|
37
|
+
In case no readable text is present, write exactly "no readable text present".
|
|
38
|
+
"""
|
|
39
|
+
|
|
31
40
|
OCR_IMAGE_DESCRIPTION_INSTRUCTIONS = """
|
|
32
41
|
Image description instructions:
|
|
33
42
|
|
|
@@ -51,7 +51,7 @@ def get_requirements(*requirements_file):
|
|
|
51
51
|
|
|
52
52
|
setup(
|
|
53
53
|
name='polytext',
|
|
54
|
-
version='0.2.
|
|
54
|
+
version='0.2.8b3',
|
|
55
55
|
url='https://github.com/docsity/polytext',
|
|
56
56
|
# download_url='https://github.com/pualien/py-polytext/archive/0.1.23.tar.gz',
|
|
57
57
|
license='MIT',
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|