hamtaa-texttools 1.1.17__py3-none-any.whl → 1.1.19__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.
@@ -1,32 +0,0 @@
1
- hamtaa_texttools-1.1.17.dist-info/licenses/LICENSE,sha256=Hb2YOBKy2MJQLnyLrX37B4ZVuac8eaIcE71SvVIMOLg,1082
2
- texttools/__init__.py,sha256=dc81lXGWP29k7oVvq2BMoMotz6lgiwX4PO2jHHBe2S8,317
3
- texttools/batch/batch_config.py,sha256=m1UgILVKjNdWE6laNbfbG4vgi4o2fEegGZbeoam6pnY,749
4
- texttools/batch/batch_runner.py,sha256=9e4SPLlvLHHs3U7bHkuuMVw8TFNwsGUzRjkAMKN4_ik,9378
5
- texttools/batch/internals/batch_manager.py,sha256=UoBe76vmFG72qrSaGKDZf4HzkykFBkkkbL9TLfV8TuQ,8730
6
- texttools/batch/internals/utils.py,sha256=F1_7YlVFKhjUROAFX4m0SaP8KiZVZyHRMIIB87VUGQc,373
7
- texttools/prompts/README.md,sha256=-5YO93CN93QLifqZpUeUnCOCBbDiOTV-cFQeJ7Gg0I4,1377
8
- texttools/prompts/categorize.yaml,sha256=F7VezB25B_sT5yoC25ezODBddkuDD5lUHKetSpx9FKI,2743
9
- texttools/prompts/detect_entity.yaml,sha256=1rhMkJOjxSQcT4j_c5SRcIm77AUdeG-rUmeidb6VOFc,981
10
- texttools/prompts/extract_entities.yaml,sha256=KiKjeDpHaeh3JVtZ6q1pa3k4DYucUIU9WnEcRTCA-SE,651
11
- texttools/prompts/extract_keywords.yaml,sha256=Vj4Tt3vT6LtpOo_iBZPo9oWI50oVdPGXe5i8yDR8ex4,3177
12
- texttools/prompts/is_question.yaml,sha256=d0-vKRbXWkxvO64ikvxRjEmpAXGpCYIPGhgexvPPjws,471
13
- texttools/prompts/merge_questions.yaml,sha256=0J85GvTirZB4ELwH3sk8ub_WcqqpYf6PrMKr3djlZeo,1792
14
- texttools/prompts/propositionize.yaml,sha256=ZEFkYy8qYpFK2oCmZ-i5M7nFtlQp_q8bKQZbFSuyE3c,792
15
- texttools/prompts/rewrite.yaml,sha256=LO7He_IA3MZKz8a-LxH9DHJpOjpYwaYN1pbjp1Y0tFo,5392
16
- texttools/prompts/run_custom.yaml,sha256=38OkCoVITbuuS9c08UZSP1jZW4WjSmRIi8fR0RAiPu4,108
17
- texttools/prompts/subject_to_question.yaml,sha256=C7x7rNNm6U_ZG9HOn6zuzYOtvJUZ2skuWbL1-aYdd3E,1147
18
- texttools/prompts/summarize.yaml,sha256=o6rxGPfWtZd61Duvm8NVvCJqfq73b-wAuMSKR6UYUqY,459
19
- texttools/prompts/text_to_question.yaml,sha256=UheKYpDn6iyKI8NxunHZtFpNyfCLZZe5cvkuXpurUJY,783
20
- texttools/prompts/translate.yaml,sha256=mGT2uBCei6uucWqVbs4silk-UV060v3G0jnt0P6sr50,634
21
- texttools/tools/async_tools.py,sha256=hbFAvBOJ8Pvocxr6cGS8WHFEYnRC6GhmVl_JxCloGhM,40163
22
- texttools/tools/sync_tools.py,sha256=kUzU3lE5ZWeBNXvmQqqVC8HWr745eOui7oZlW3-7mJo,39964
23
- texttools/tools/internals/async_operator.py,sha256=1TMr8e1qbE9GSz8jl0q3MKdM8lIYE-1ZuSxHjYPqKHI,7198
24
- texttools/tools/internals/formatters.py,sha256=tACNLP6PeoqaRpNudVxBaHA25zyWqWYPZQuYysIu88g,941
25
- texttools/tools/internals/models.py,sha256=lbhwH8FMwKkLnIOqu4jK3HNv4q_CrY9w3QQ_stlPs1Y,5961
26
- texttools/tools/internals/operator_utils.py,sha256=w1k0RJ_W_CRbVc_J2w337VuL-opHpHiCxfhEOwtyuOo,1856
27
- texttools/tools/internals/prompt_loader.py,sha256=4g6-U8kqrGN7VpNaRcrBcnF-h03PXjUDBP0lL0_4EZY,1953
28
- texttools/tools/internals/sync_operator.py,sha256=4-V__o55Q8w29lWxkhG4St-exZLZTfBbiW76knOXbc0,7106
29
- hamtaa_texttools-1.1.17.dist-info/METADATA,sha256=2h8GKwr3HKsaW10OKofe_JMZDD7Jas9cdvFFEwFCS_M,9680
30
- hamtaa_texttools-1.1.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
- hamtaa_texttools-1.1.17.dist-info/top_level.txt,sha256=5Mh0jIxxZ5rOXHGJ6Mp-JPKviywwN0MYuH0xk5bEWqE,10
32
- hamtaa_texttools-1.1.17.dist-info/RECORD,,
@@ -1,22 +0,0 @@
1
- main_template: |
2
- You are an expert Named Entity Recognition (NER) system. Extract entities from the text.
3
- The output must strictly follow the provided Pydantic schema.
4
-
5
- Mapping Rule:
6
- - Person: شخص
7
- - Location: مکان
8
- - Time: زمان
9
- - Living Beings: موجود زنده
10
- - Organization: سازمان
11
- - Concept: مفهوم
12
-
13
- CRITICAL:
14
- 1. The final output structure must be a complete JSON object matching the Pydantic schema (List[Entity]).
15
- 2. Both the extracted text and the type must be in Persian, using the exact mapping provided above.
16
-
17
- Here is the text: {input}
18
-
19
- analyze_template: |
20
- Analyze the following text to identify all potential named entities and their categories (Person, Location, Time, Living Beings, Organization, Concept).
21
- Provide a brief summary of the entities identified that will help the main process to extract them accurately and apply the correct Persian type label.
22
- Here is the text: {input}
@@ -1,56 +0,0 @@
1
- from functools import lru_cache
2
- from pathlib import Path
3
- import yaml
4
-
5
-
6
- class PromptLoader:
7
- """
8
- Utility for loading and formatting YAML prompt templates.
9
-
10
- Responsibilities:
11
- - Load and parse YAML prompt definitions.
12
- - Select the right template (by mode, if applicable).
13
- - Inject variables (`{input}`, plus any extra kwargs) into the templates.
14
- """
15
-
16
- MAIN_TEMPLATE = "main_template"
17
- ANALYZE_TEMPLATE = "analyze_template"
18
-
19
- @staticmethod
20
- def _build_format_args(text: str, **extra_kwargs) -> dict[str, str]:
21
- # Base formatting args
22
- format_args = {"input": text}
23
- # Merge extras
24
- format_args.update(extra_kwargs)
25
- return format_args
26
-
27
- # Use lru_cache to load each file once
28
- @lru_cache(maxsize=32)
29
- def _load_templates(self, prompt_file: str, mode: str | None) -> dict[str, str]:
30
- """
31
- Loads prompt templates from YAML file with optional mode selection.
32
- """
33
- base_dir = Path(__file__).parent.parent.parent / Path("prompts")
34
- prompt_path = base_dir / prompt_file
35
- data = yaml.safe_load(prompt_path.read_text(encoding="utf-8"))
36
-
37
- return {
38
- self.MAIN_TEMPLATE: data[self.MAIN_TEMPLATE][mode]
39
- if mode
40
- else data[self.MAIN_TEMPLATE],
41
- self.ANALYZE_TEMPLATE: data.get(self.ANALYZE_TEMPLATE)[mode]
42
- if mode
43
- else data.get(self.ANALYZE_TEMPLATE),
44
- }
45
-
46
- def load(
47
- self, prompt_file: str, text: str, mode: str, **extra_kwargs
48
- ) -> dict[str, str]:
49
- template_configs = self._load_templates(prompt_file, mode)
50
- format_args = self._build_format_args(text, **extra_kwargs)
51
-
52
- # Inject variables inside each template
53
- for key in template_configs.keys():
54
- template_configs[key] = template_configs[key].format(**format_args)
55
-
56
- return template_configs
File without changes