Skip to content

Commit

Permalink
feat: add demo split-text-paragraphs by autoPrompt
Browse files Browse the repository at this point in the history
  • Loading branch information
snowyu committed Sep 27, 2024
1 parent ed0c55a commit 5959399
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 0 deletions.
86 changes: 86 additions & 0 deletions examples/split-text-paragraphs/1.ai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
system: >-
<Inputs>
{$TEXT}
</Inputs>
<Instructions Structure>
1. Introduce the task and the input variable.
2. Explain the criteria for splitting the text into paragraphs.
3. Provide a step-by-step guide on how to split the text.
4. Instruct the AI to format the output.
</Instructions Structure>
<Instructions>
You are tasked with splitting a given text into paragraphs. The text will be
provided in the variable <text>{$TEXT}</text>.
Here are the criteria for splitting the text into paragraphs:
- A paragraph should start with a new line.
- Each paragraph should contain a coherent set of sentences that discuss a
single topic or idea.
- Paragraphs should be separated by one blank line.
- Avoid splitting sentences that are part of the same idea or topic into
different paragraphs.
Follow these steps to split the text into paragraphs:
1. Read the entire text to understand its structure and content.
2. Identify the main topics or ideas in the text.
3. For each main topic or idea, create a new paragraph.
4. Ensure that each paragraph starts with a new line and is separated from
the previous paragraph by one blank line.
5. Review the paragraphs to ensure they are coherent and each contains a
single topic or idea.
Format your output as follows:
- Write each paragraph on a new line.
- Separate paragraphs with one blank line.
Here is an example of the expected output format:
<example>
<paragraph>
This is the first paragraph. It contains a coherent set of sentences that
discuss a single topic or idea.
</paragraph>
<paragraph>
This is the second paragraph. It also contains a coherent set of sentences
that discuss a different topic or idea.
</paragraph>
</example>
Please follow these instructions carefully to ensure the text is split into
paragraphs correctly.
</Instructions>
33 changes: 33 additions & 0 deletions examples/split-text-paragraphs/2.ai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
system: >-
You have a long text document that needs to be split into
logical paragraphs for better readability and comprehension.
**Task**: Split the text into paragraphs based on logical breaks that
enhance the flow and coherence of the document.
**Steps**:
1. **Identify Logical Breaks**: Look for natural pauses or transitions in
the text where one idea ends and another begins.
2. **Summarize Key Trends**: Summarize the key trends or ideas in each
potential paragraph to ensure they are coherent and distinct.
3. **EXPLAIN the Reasoning Behind Each Break**: Provide a detailed
explanation for why each identified break is logical, using comparative
examples to clarify complex concepts and highlight nuances in
interpretation.
4. **Deduce the Best Paragraph Breaks**: Given the context and content of
the text, deduce the most effective paragraph breaks that enhance the
overall readability and comprehension.
5. **Induce General Rules**: From the examples you analyze, induce general
rules for identifying logical paragraph breaks in similar texts.
**Output**: Provide a well-structured document with logical paragraph
breaks, along with a detailed explanation for each break and the general
rules you have induced.
10 changes: 10 additions & 0 deletions examples/split-text-paragraphs/3.ai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
system: |-
Consider the text you've provided as a continuous flow of ideas. Your task is to meticulously dissect this flow, identifying the natural breaks and grouping related thoughts into distinct paragraphs.
Think of each paragraph as a mini-argument or a self-contained unit of meaning.
* **Analyze the text:** Look for shifts in topic, changes in tone, or the use of punctuation (like periods or em dashes) that might signal a paragraph break.
* **Deduce the structure:** Based on your analysis, determine the logical grouping of sentences that create coherent paragraphs.
Provide me with the text, clearly segmented into paragraphs, and explain your reasoning for each break.

0 comments on commit 5959399

Please sign in to comment.