hamtaa-texttools 1.0.0__tar.gz → 1.0.2__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.
Files changed (35) hide show
  1. hamtaa_texttools-1.0.2/MANIFEST.in +2 -0
  2. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/PKG-INFO +1 -1
  3. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/hamtaa_texttools.egg-info/PKG-INFO +1 -1
  4. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/hamtaa_texttools.egg-info/SOURCES.txt +12 -0
  5. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/pyproject.toml +7 -1
  6. hamtaa_texttools-1.0.2/texttools/prompts/README.md +31 -0
  7. hamtaa_texttools-1.0.2/texttools/prompts/categorizer.yaml +25 -0
  8. hamtaa_texttools-1.0.2/texttools/prompts/keyword_extractor.yaml +11 -0
  9. hamtaa_texttools-1.0.2/texttools/prompts/ner_extractor.yaml +18 -0
  10. hamtaa_texttools-1.0.2/texttools/prompts/question_detector.yaml +12 -0
  11. hamtaa_texttools-1.0.2/texttools/prompts/question_generator.yaml +22 -0
  12. hamtaa_texttools-1.0.2/texttools/prompts/question_merger.yaml +47 -0
  13. hamtaa_texttools-1.0.2/texttools/prompts/question_rewriter.yaml +44 -0
  14. hamtaa_texttools-1.0.2/texttools/prompts/subject_question_generator.yaml +27 -0
  15. hamtaa_texttools-1.0.2/texttools/prompts/summarizer.yaml +11 -0
  16. hamtaa_texttools-1.0.2/texttools/prompts/translator.yaml +14 -0
  17. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/LICENSE +0 -0
  18. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/README.md +0 -0
  19. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/hamtaa_texttools.egg-info/dependency_links.txt +0 -0
  20. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/hamtaa_texttools.egg-info/requires.txt +0 -0
  21. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/hamtaa_texttools.egg-info/top_level.txt +0 -0
  22. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/setup.cfg +0 -0
  23. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/tests/test_tools.py +0 -0
  24. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/__init__.py +0 -0
  25. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/formatters/base_formatter.py +0 -0
  26. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/formatters/user_merge_formatter/user_merge_formatter.py +0 -0
  27. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/tools/__init__.py +0 -0
  28. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/tools/operator.py +0 -0
  29. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/tools/output_models.py +0 -0
  30. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/tools/prompt_loader.py +0 -0
  31. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/tools/the_tool.py +0 -0
  32. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/utils/__init__.py +0 -0
  33. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/utils/batch_manager/__init__.py +0 -0
  34. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/utils/batch_manager/batch_manager.py +0 -0
  35. {hamtaa_texttools-1.0.0 → hamtaa_texttools-1.0.2}/texttools/utils/batch_manager/batch_runner.py +0 -0
@@ -0,0 +1,2 @@
1
+ graft texttools/prompts
2
+ global-exclude *.pyc
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hamtaa-texttools
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: TextTools is a high-level NLP toolkit built on top of modern LLMs.
5
5
  Author-email: Tohidi <the.mohammad.tohidi@gmail.com>, Montazer <montazerh82@gmail.com>, Givechi <mohamad.m.givechi@gmail.com>, MoosaviNejad <erfanmoosavi84@gmail.com>
6
6
  License: MIT License
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hamtaa-texttools
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: TextTools is a high-level NLP toolkit built on top of modern LLMs.
5
5
  Author-email: Tohidi <the.mohammad.tohidi@gmail.com>, Montazer <montazerh82@gmail.com>, Givechi <mohamad.m.givechi@gmail.com>, MoosaviNejad <erfanmoosavi84@gmail.com>
6
6
  License: MIT License
@@ -1,4 +1,5 @@
1
1
  LICENSE
2
+ MANIFEST.in
2
3
  README.md
3
4
  pyproject.toml
4
5
  hamtaa_texttools.egg-info/PKG-INFO
@@ -10,6 +11,17 @@ tests/test_tools.py
10
11
  texttools/__init__.py
11
12
  texttools/formatters/base_formatter.py
12
13
  texttools/formatters/user_merge_formatter/user_merge_formatter.py
14
+ texttools/prompts/README.md
15
+ texttools/prompts/categorizer.yaml
16
+ texttools/prompts/keyword_extractor.yaml
17
+ texttools/prompts/ner_extractor.yaml
18
+ texttools/prompts/question_detector.yaml
19
+ texttools/prompts/question_generator.yaml
20
+ texttools/prompts/question_merger.yaml
21
+ texttools/prompts/question_rewriter.yaml
22
+ texttools/prompts/subject_question_generator.yaml
23
+ texttools/prompts/summarizer.yaml
24
+ texttools/prompts/translator.yaml
13
25
  texttools/tools/__init__.py
14
26
  texttools/tools/operator.py
15
27
  texttools/tools/output_models.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "hamtaa-texttools"
7
- version = "1.0.0"
7
+ version = "1.0.2"
8
8
  authors = [
9
9
  { name = "Tohidi", email = "the.mohammad.tohidi@gmail.com" },
10
10
  { name = "Montazer", email = "montazerh82@gmail.com" },
@@ -24,3 +24,9 @@ keywords = ["nlp", "llm", "text-processing", "openai"]
24
24
  [tool.setuptools.packages.find]
25
25
  where = ["."]
26
26
  include = ["texttools*"]
27
+
28
+ [tool.setuptools]
29
+ include-package-data = true
30
+
31
+ [tool.setuptools.package-data]
32
+ "texttools" = ["prompts/*.yaml", "prompts/*.yml"]
@@ -0,0 +1,31 @@
1
+ # Prompts
2
+
3
+ ## Overview
4
+ This folder contains YAML files for all prompts used in the project. Each file represents a separate prompt template, which can be loaded by tools or scripts that require structured prompts for AI models.
5
+
6
+ ## Structure
7
+ - **prompt_file.yaml**: Each YAML file represents a single prompt template.
8
+ - **main_template**: The main instruction template for the model.
9
+ - **analyze_template** (optional): A secondary reasoning template used before generating the final response.
10
+ - **Modes** (optional): Some prompts may have multiple modes (e.g., `default_mode`, `reason_mode`) to allow different behaviors.
11
+
12
+ ### Example YAML Structure
13
+ ```yaml
14
+ main_template:
15
+ default_mode: |
16
+ Your main instructions here with placeholders like {input}.
17
+ reason_mode: |
18
+ Optional reasoning instructions here.
19
+
20
+ analyze_template:
21
+ default_mode: |
22
+ Analyze and summarize the input.
23
+ reason_mode: |
24
+ Optional detailed analysis template.
25
+ ```
26
+
27
+ ## Guidelines
28
+ 1. **Naming**: Use descriptive names for each YAML file corresponding to the tool or task it serves.
29
+ 2. **Placeholders**: Use `{input}` or other relevant placeholders to dynamically inject data.
30
+ 3. **Modes**: If using modes, ensure both `main_template` and `analyze_template` contain the corresponding keys.
31
+ 4. **Consistency**: Keep formatting consistent across files for easier parsing by scripts.
@@ -0,0 +1,25 @@
1
+ main_template: |
2
+ You are a religious scholar.
3
+ As a user, I give you a text and ask you to classify that text into one of the following categories:
4
+ "باورهای دینی",
5
+ "اخلاق اسلامی",
6
+ "احکام و فقه",
7
+ "تاریخ اسلام و شخصیت ها",
8
+ "منابع دینی",
9
+ "دین و جامعه/سیاست",
10
+ "عرفان و معنویت",
11
+ "هیچکدام",
12
+ Respond only in this JSON format:
13
+ {{
14
+ "reason": "<Summary of why did you choose this category?>",
15
+ "result": "<One of the above tags>"
16
+ }}
17
+ Here is the text:
18
+ {input}
19
+
20
+ analyze_template: |
21
+ Our goal is to categorize the text.
22
+ Read the text and respond the main idea and a short analysis of that.
23
+ Maximum words: 20
24
+ Here is the text:
25
+ {input}
@@ -0,0 +1,11 @@
1
+ main_template: |
2
+ Extract the most relevant keywords from the following text. Provide them as a list of strings.
3
+ {input}
4
+ Respond only in JSON format:
5
+ {{"result": ["keyword1", "keyword2", ...]}}.
6
+ Respond in the language of the input text.
7
+
8
+ analyze_template: |
9
+ Analyze the following text to identify its main topics, concepts, and important terms.
10
+ Provide a concise summary of your findings that will help in extracting relevant keywords.
11
+ {input}
@@ -0,0 +1,18 @@
1
+ main_template: |
2
+ Identify and extract all named entities (e.g., PER, ORG, LOC, DAT, etc.) from the following text. For each entity, provide its text and a clear type.
3
+ Respond as a JSON array of objects.
4
+ {input}
5
+ Respond only in JSON format:
6
+ {{
7
+ "result": [
8
+ {{
9
+ "text": "string",
10
+ "type": "string",
11
+ }}
12
+ ]
13
+ }}
14
+
15
+ analyze_template: |
16
+ Read the following text and identify any proper nouns, key concepts, or specific mentions that might represent named entities.
17
+ Provide a brief, summarized analysis that could help in categorizing these entities.
18
+ {input}
@@ -0,0 +1,12 @@
1
+ main_template: |
2
+ Determine that if the following text contains any question or request of some kind or not.
3
+ Respond only in JSON format:
4
+ {{"result": "true/false"}}
5
+ {input}
6
+
7
+ analyze_template: |
8
+ We want to analyze this text snippet to see if it contains any question or request of some kind or not.
9
+ Read the text, and reason about it being a request or not.
10
+ Summerized, short answer.
11
+ {input}
12
+
@@ -0,0 +1,22 @@
1
+ main_template: |
2
+ Given the following answer, generate a single,
3
+ appropriate question that this answer would directly respond to.
4
+ The generated answer should be independently meaningful,
5
+ and not mentioning any verbs like, this, that, he or she on the question.
6
+ The generated question must be in the language of the user's input.
7
+ Here is the text:
8
+ {input}
9
+ Respond only in JSON format:
10
+ {{"result": "string"}}
11
+ Respond only with the new generated question, without any additional information.
12
+
13
+ analyze_template: |
14
+ Analyze the following answer to identify its key facts,
15
+ main subject, and what kind of information it provides.
16
+ Provide a brief, summarized understanding of the answer's content that will
17
+ help in formulating a relevant and direct question.
18
+ Provide the summary in the language of the content.
19
+ Just mention the keypoints that was provided in the answer
20
+ Here is the text:
21
+ {input}
22
+
@@ -0,0 +1,47 @@
1
+ main_template:
2
+
3
+ default_mode: |
4
+ You are a language expert.
5
+ I will give you a list of questions that are semantically similar.
6
+ Your task is to merge them into one unified question that:
7
+ - Preserves all the information and intent from the original questions.
8
+ - Sounds natural, fluent, and concise.
9
+ - Avoids redundancy or unnecessary repetition.
10
+ - Does not omit any unique idea from the originals.
11
+ Output only the merged question.
12
+ Here is the questions: {input}
13
+ Respond only in JSON format:
14
+ {{"result": "string"}}
15
+ Respond only with the new generated question, without any additional information.
16
+ The generated question must be in the language of the users input.
17
+
18
+ reason_mode: |
19
+ You are an AI assistant helping to unify semantically similar questions.
20
+ First, briefly extract the unique intent or content from each input question.
21
+ Then, write one merged question that combines all their content clearly and naturally, without redundancy.
22
+ Step 1: Extract key ideas.
23
+ Step 2: Write the final merged question.
24
+ Here is the questions: {input}
25
+ Respond only in JSON format:
26
+ {{"result": "string"}}
27
+ Respond only with the new generated question, without any additional information.
28
+ The generated question must be in the language of the users input.
29
+
30
+ analyze_template:
31
+
32
+ default_mode: |
33
+ Analyze the following questions to identify their core intent, key concepts,
34
+ and the specific information they are seeking.
35
+ Provide a brief, summarized understanding of the questions' meaning that
36
+ will help in merging and rephrasing it accurately without changing its intent.
37
+ Respond in the language of the question.
38
+ Here is the question: {input}
39
+
40
+ reason_mode: |
41
+ Analyze the following questions to identify their exact wording, phrasing,
42
+ and the literal meaning it conveys.
43
+ Provide a brief, summarized analysis of their linguistic structure and current meaning,
44
+ which will then be used to create a new question containing all of their contents.
45
+ Respond in the language of the question.
46
+ Here is the question: {input}
47
+
@@ -0,0 +1,44 @@
1
+ main_template:
2
+
3
+ same_meaning_different_wording_mode: |
4
+ Rewrite the following question using completely different wording and phrasing,
5
+ ensuring its original meaning is perfectly preserved. The rewritten question
6
+ should be distinct from the original but convey the exact same inquiry.
7
+ Here is the question:
8
+ {input}
9
+ Respond only in JSON format:
10
+ {{"result": "string"}}
11
+ Respond only with the new generated question, without any additional information.
12
+ The generated question must be in the language of the users input.
13
+
14
+ different_meaning_similar_wording_mode: |
15
+ Rewrite the following question using *very similar wording and phrasing*
16
+ to the original, but ensure the rewritten question has a *completely different meaning*.
17
+ Focus on subtle changes that drastically alter the intent or subject of the question.
18
+ Here is the question:
19
+ {input}
20
+ Respond only in JSON format:
21
+ {{"result": "string"}}
22
+ Respond only with the new generated question, without any additional information.
23
+ The generated question must be in the language of the users input.
24
+
25
+ analyze_template:
26
+
27
+ same_meaning_different_wording_mode: |
28
+ Analyze the following question to identify its core intent, key concepts,
29
+ and the specific information it is seeking.
30
+ Provide a brief, summarized understanding of the question's meaning that
31
+ will help in rephrasing it accurately without changing its intent.
32
+ Respond in the language of the question.
33
+ Here is the question:
34
+ {input}
35
+
36
+ different_meaning_similar_wording_mode: |
37
+ Analyze the following question to identify its exact wording, phrasing,
38
+ and the literal meaning it conveys.
39
+ Provide a brief, summarized analysis of its linguistic structure and current meaning,
40
+ which will then be used to create a new question with similar words but a different meaning.
41
+ Respond in the language of the question.
42
+ Here is the question:
43
+ {input}
44
+
@@ -0,0 +1,27 @@
1
+ main_template: |
2
+ Given the following subject, generate {number_of_questions} appropriate questions that this subject would directly respond to.
3
+ The generated subject should be independently meaningful,
4
+ and it must not mention any verbs like, this, that, he or she and etc. in the question.
5
+ The generated question must be in {language} language.
6
+ Here is the text:
7
+ {input}
8
+ Respond only with the new generated question, without any additional information.
9
+ The generated question must be in {language} language.
10
+ Generate {number_of_questions} number of questions in the questions list.
11
+ You must return ONLY a single JSON object that matches the schema.
12
+ There is a `reason` key, fill that up with a really summerized version
13
+ of your thoughts.
14
+ The `reason` must be less than 20 words.
15
+ Respond only in JSON format:
16
+ {{"result": [string, string, ...]}}
17
+
18
+ analyze_template: |
19
+ Our goal is to generate questions, from the given subject that I've provided.
20
+ The questions must be meaningfull, some of them should be specific and some should be general.
21
+ But first, in this step we want to analyze the subject that I asked to generate questions for it.
22
+ We need a summerized analysis of the subject.
23
+ What is the subject about?
24
+ What point of views can we see and generate questoins from it? (Questions that real users might have.)
25
+ Here is the subject:
26
+ {input}
27
+ Respond only in {language} language.
@@ -0,0 +1,11 @@
1
+ main_template: |
2
+ Provide a concise summary of the following text:
3
+ {input}
4
+ Respond only in JSON format:
5
+ {{"result": "string"}}
6
+
7
+ analyze_template: |
8
+ Read the following text and identify its main points, key arguments, and overall purpose.
9
+ Provide a brief, summarized analysis that will help in generating an accurate and concise summary.
10
+ {input}
11
+
@@ -0,0 +1,14 @@
1
+ main_template: |
2
+ You are a {target_language} translator.
3
+ Output only the translated text. No comments, no explanations, no markdown.
4
+ Translate the following text to {target_language}:
5
+ {input}
6
+ Respond only in JSON format:
7
+ {{"result": "string"}}
8
+
9
+ analyze_template: |
10
+ Analyze the following text and identify important linguistic considerations for translation.
11
+ Do not translate the text. Point out any idioms, cultural references, or complex structures that need special attention.
12
+ Also, list all proper nouns that should not be translated. Write your analysis in the {target_language}.
13
+ {input}
14
+