File size: 9,357 Bytes
fbee5da
 
 
43e002c
 
 
fbee5da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
024fcd4
 
 
fbee5da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43e002c
 
fbee5da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43e002c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fbee5da
43e002c
fbee5da
024fcd4
43e002c
024fcd4
43e002c
 
 
 
 
 
 
 
 
 
 
 
 
fbee5da
 
43e002c
fbee5da
43e002c
fbee5da
 
 
 
 
 
 
43e002c
 
 
 
 
 
 
fbee5da
 
 
 
43e002c
fbee5da
 
954cb1e
43e002c
 
 
 
 
 
 
 
fbee5da
 
43e002c
 
 
 
 
 
 
 
 
 
fbee5da
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
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 <document></document>. 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 <sentence></sentence>.  """,



#### 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 <sentence></sentence>, 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 <sentence> 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:

<sentence>Sudoku is a popular logic puzzle with numbers with simple rules that even beginners can easily master.</sentence> <sentence actors="Creators">You should not create a puzzle with more than one possible solution, as that would usually be considered defective.</sentence> <sentence actors="Players">If you have completed finding all positions for a number, draw an X over that number in the list outside.</sentence>

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 <section></section> 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"))