import re
prompts = {
#### INFORMATION TYPES
"intro-structured-writing":
"To write clearly, it is important to follow certain standards. You are a helpful assistant who can answer questions and make suggestions about the best ways to convey complex concepts in writing.",
"intro-information-types":
"""There are five information types in technical writing:
• reference
• concept
• principle
• process
• task""",
"recognize-information-types":
"""To recognize the information type in a piece of content, identify:
• the question the content is trying to answer
• the purpose of the content
• the intended user response after reading the content
Tip: If the information type is unclear, treat it as reference.""",
"description-reference":
"""Reference information states things that the reader needs to know. It provides the facts and specific details required for a subject.
Use reference information to answer:
• What are the facts?
• What does a [something] look like?
• What are [something’s] parts?""",
"titling-reference":
"""Effective titles for reference information describe the item and anything that differentiates it from other items.""",
"description-concept":
"""Concept information explains something that the user needs to understand.
Use concept information to answer:
• What is [something]?
• What does [something] mean?""",
"titling-concept":
"""Effective titles for concept topics name the concept using the plural form of the noun, where one exists. The title does not include additional words such as “what is”, “about” or “definition of”.""",
"description-principle":
"""Principle information advises the user on what they need to do or not do, and when.
Use principle information to answer:
• What should, or must I do?
• What should, or must I not do?""",
"titling-principle":
"""A title for principle information identifies the principle and expresses the gravity of the principle. The gravity of a principle reflects its seriousness, from a general suggestion to a law.""",
"description-process":
"""Process information illustrates how things work using a series of stages or phases.
Use process information to answer:
• What happens after what?
• Who does what?
• How does this work?
There are two types of process.
• Human process — What people do collectively to achieve an outcome
• Systems process — What happens within a system to describe how something works""",
"titling-process":
"""Human process titles use the gerund (...ing) form of a verb followed by the plural form of the noun.
Systems process titles use the construction “how items work”, using the plural form of the noun, wherever possible. The word "work" is not mandatory. Regardless of the verb used, it must agree with the noun.""",
"description-task":
"""Task information instructs the user on the steps to follow to achieve a specific result.
Use task information to answer:
• How do I do it?
• What do I do?""",
"titling-task":
"""A title for task information is written as a command. An effective title for a task topic:
• states the subject matter covered in the task
• starts with an imperative (“command”) form of a verb, not its gerund (“...ing”)
• includes an article (“a”, “an”, or “the”)""",
"information-types":
"""#intro-structured-writing
#intro-information-types
#recognize-information-types
1. #description-reference
2. #description-concept
3. #description-principle
4. #description-process
5. #description-task
""",
"information-types-titling-full":
"""#intro-information-types
#recognize-information-types
1. #description-reference
#titling-reference
2. #description-concept
#titling-concept
3. #description-principle
#titling-principle
4. #description-process
#titling-process
5. #description-task
#titling-task""",
"information-types-titling":
"""#intro-information-types
1. #titling-reference
2. #titling-concept
3. #titling-principle
4. #titling-process
5. #titling-task""",
#### CHUNKS
"q-chunk-information-type":
"""Please determine the most likely content type of the chunk of content below. First, give one paragraph of your reasoning. Then, give a list of the information types applicable, one per line, in the order of most likely to least likely, so the first line contains the most likely information type.
CONTENT:
{content}""",
"q-title-chunk":
"""Please suggest the most likely content type of the chunk of content below. The information type of this content is {information_type}. First, give your reasoning as a single paragraph. Then, on a separate line, give just the suggested title for the content, without quotes or prefixes.
CONTENT CHUNK:
{content}""",
#### GENERAL
"document-general": """You are a copyeditor's assistant. You will be helping me to check, improve, and rewrite a document.
""",
"section-general": """You are a copyeditor's assistant. You will be helping me to check, improve, and rewrite a section in a large document.
""",
#### SIDEINFO
"document-actor": """Someone has compiled the following list of actors that are relevant to a document:
{value}
""",
#### INTRO
"document-intro": """Below, the document goes inside . Please read the whole document carefully. Remember everything you know about the concepts it touches.
""",
#### SUMMARIES
"document-what-this-is": """This {name} is a {value}.""",
"document-summary": """Here's a summary of the {name}:
{value}.""",
#### SELECT
"select-sentence-all": """In the document below, all sentences are marked up with . """,
#### Q
"q-singlevalue-what-this-is": """Give a short noun phrase (without article) describing what this document is. Examples: "Textbook about interpersonal psychology", "State standard on oil rig equipment", "User manual for a smartphone app".
Write just one line with the description.
""",
"q-singlevalue-summary": """Give a one-paragraph summary of the document's content. Write just one paragraph with the summary.
""",
"q-list-concept": """Read the document. Compile a list of the main concepts that this document talks about. Output the line "CONCEPTS:" followed by a list of concepts, one per line.
For example, for an instruction manual for a chainsaw, you could output:
CONCEPTS:
- Power tool
- Safety
- Work area
- Saw chain
- Wood
""",
"q-list-actor": """Read the document. Think about who are the actors implied in the document. Who are the parties that this document is authored by, is governed by, is addressed to? Often, these parties are not explicitly stated in the document, so you will need to use your common sense. See if you can compile a minimal list of the main actors that the document is concerned with. Output the line "ACTORS:" followed by a list of actors, one per line.
For example, for an instruction manual for a chainsaw, you could output:
ACTORS:
- Chainsaw manufacturer
- Chainsaw user
- Children and bystanders
""",
"q-sentence-actor": """Your goal is to annotate each sentence of this document, inside a , with its intended actor or actors by picking one or more parties from the list of actors. For each sentence, ask yourself: which of the parties from the list are the subjects? Who does the action described here? If there's no actor, leave the sentence unmarked.
Add the relevant partes, separated by commas, inside the "actors" attribute of each tag. For example, suppose you have a document describing the game of Sudoku, and your parties are "Players" and "Creators". Here are example sentences with audience markup:
Sudoku is a popular logic puzzle with numbers with simple rules that even beginners can easily master. You should not create a puzzle with more than one possible solution, as that would usually be considered defective. If you have completed finding all positions for a number, draw an X over that number in the list outside.
Output just the document adding the actors attributes for sentences, but otherwise unchanged.
""",
"q-section-section": """Your goal is to break this document into sections. Think of how to best locate section boundaries without changing the text of the document. Mark up the text with tags enclosing each section, otherwise keep the text unchanged.
""",
#### MATERIAL
"material": """Here is the {name}:
{value}""",
}
def prompt_replacement(matchobj):
return prompts[matchobj.group(0)[1:]]
def get_prompt_recursive(text):
if not('#' in text):
return text
else:
text = re.sub(r'#[a-z0-9-]+', prompt_replacement, text)
return get_prompt_recursive(text)
def get_prompt(ref):
text = "#" + ref if not(ref.startswith('#')) else ref
return get_prompt_recursive(text)
if __name__ == "__main__":
print(get_prompt("information-types-titling"))