mcPear commited on
Commit
fe2bcc3
·
1 Parent(s): 95fb091

chore: organise 'types' and 'editorial guidelines' sections

Browse files
Files changed (1) hide show
  1. app.py +94 -86
app.py CHANGED
@@ -8,27 +8,35 @@ import itertools
8
  nltk.download("punkt")
9
  spell = SpellChecker()
10
 
11
- st.title("Medium Headline")
12
- st.caption("Medium headline guidelines articles turned into an interactive app")
13
 
14
 
15
- st.header("Start with typing your headline idea")
16
- headline = st.text_input("", "7 Steps How To NOT Make an Oak Coffee Table")
 
 
 
 
 
17
 
18
  # TODO
19
  # """
20
  # MVP
21
  # - keep merging guidelines
22
- # - fill help when possible, for types too, clean up
 
23
  # - ask Danni for help
24
 
25
- # Workshoping:
26
  # - try to write a headline with that tool
27
  # - use columns or expander to organise that
 
28
  # - ask in Facebook/reddit group/privs Medium Wroters/bloggers for feedback!
29
  # - own domain (host on Streamlit)
30
 
31
  # Features:
 
32
  # - bloom few shot for high-level guidelines
33
  # - train paraphraser to specific types
34
  # - BERT for suprise metric
@@ -38,14 +46,14 @@ headline = st.text_input("", "7 Steps How To NOT Make an Oak Coffee Table")
38
  # """
39
 
40
  # 1 Substantial guidelines
41
- st.header("Substantial guidelines")
42
- st.subheader("Make sure your headline answers the ultimate questions:")
43
  st.checkbox("What the story is about?")
44
  st.checkbox(
45
  "Why the story matters to a reader?"
46
- ) # TODO does examplary headlines really answer that?
47
 
48
- st.subheader("Make sure the headline is:")
49
 
50
  ### interesting
51
  st.checkbox("focused on what is most interesting")
@@ -70,19 +78,19 @@ st.checkbox( # TODO it's optional depending on the audience
70
  help="Avoid jargon, and think of what makes sense in casual conversation. Know the language that your audience is familiar with.",
71
  )
72
  st.checkbox(
73
- "Deliver on your promises.",
74
  help="You’re building a relationship with your readers. The headline sets the expectations, and the story must deliver on that.",
75
  )
76
  st.checkbox(
77
- "Don’t ask a question unless you know the answer.",
78
  help="You’re building a relationship with your readers. The headline sets the expectations, and the story must deliver on that.",
79
  )
80
  st.checkbox(
81
- "If you want to be poetic or clever in your headline, follow it up with a strong subheadline.",
82
  help="You may want to be poetic, clever, or artistic in the title. The challenge with crafting a title this way is that it becomes opaque. It’s also much easier to write a bad title when striving for something poetic or clever than if you’re going for clarity. In most cases, the reader won’t click to find out more because they didn’t understand what the story was about in the first place.",
83
  )
84
 
85
- st.subheader("Guiding questions to consider:")
86
  st.checkbox(
87
  "Make it clear. Could the headline be clearer?"
88
  ) # there is such type (is it rule along others or individual style)
@@ -110,22 +118,17 @@ st.checkbox(
110
  help="“Be aware of who is in the room writing the headline and what the limits of their perspective might be,” shares Rawls. Often biases will show up in the adjectives you use, so double-check the ones you use, and consider what they may unintentionally express.",
111
  )
112
 
113
- st.checkbox(
114
- "The key to writing a tempting benefit-based headline is to be specific.",
115
- help="“How to Wake Up Smiling: The 9 Decisions That Led To A Life I Love”\n“This 3-Minute Exercise Will Change the Way You Solve Problems”\n“How I Doubled My Writing Income Overnight By Focusing on One Skill”",
116
- )
117
-
118
- # 2 Editorial guidelines
119
-
120
- st.subheader("Avoid:")
121
- st.checkbox("all caps") # implement warning?
122
  # alpha_chars = [c for c in headline if c.isalpha()]
123
  # upper_chars = [c for c in alpha_chars if c.isupper()]
124
  # upper_ratio = upper_chars / alpha_chars
125
  # is_mostly_upper = upper_ratio > 0.8
126
  # TODO show is_mostly_upper
127
 
128
- st.checkbox("all typos") # red -> green, Spacy
 
129
  # if headline:
130
  # ll = [
131
  # [word_tokenize(w), " "] for w in headline.split()
@@ -139,13 +142,20 @@ st.checkbox("all typos") # red -> green, Spacy
139
  # "Especially consider:"
140
  # st.info(headline)
141
 
142
- st.checkbox("links") # implement warning with regex
143
- "Easy on the gerunds (-ing words)." "People are 70% more likely to click on the nongerund headlines." # TODO implement check
144
- "Don’t write a headline like you would a book title (avoid one-word or two-word headlines)." # TODO implement check
 
 
 
 
 
 
145
 
146
- # 4 Proven Headline Types OK
147
 
148
  st.subheader("Proven Headline Types")
 
149
  st.write("**Analysis**")
150
  st.markdown(
151
  """
@@ -170,6 +180,15 @@ st.markdown(
170
  """
171
  )
172
 
 
 
 
 
 
 
 
 
 
173
  st.write("**Descriptive teaser**")
174
  st.markdown(
175
  """
@@ -190,56 +209,55 @@ st.markdown(
190
  """
191
  )
192
 
193
- st.write("**Quote**")
194
- st.markdown("- Mom, Why Don’t You Have Any Black Friends?")
195
-
196
- st.write("**Coining terms**")
197
  st.markdown(
198
  """
199
- - When Black Women Go From Office Pet to Office Threat
200
- - Nazi Hippies: When the New Age and Far Right Overlap
201
  """
202
  )
203
 
204
- st.write("**Personal headlines**")
205
  st.markdown(
206
  """
207
- - It's 2020, And I Had to Leave My Home Because of the KKK
 
 
208
  """
209
  )
210
 
211
- st.write("**Validate readers’ feelings**")
212
- st.markdown(
213
- """
214
- - In Defense of the Super Low-Key Workout
215
- """
216
  )
217
-
218
- st.write("**Clear promises**")
219
  st.markdown(
220
  """
221
- - How to Talk To an Employee Obsessed With Promotion
222
- - An Embarassing Story Is a Secret Weapon to Work
 
223
  """
224
  )
225
 
226
- st.write("**Effective use of “I”**")
227
  st.markdown(
228
  """
229
- - How I Accidentally Wound Up Running an Outlaw Bigger Gang in Ohio
 
 
230
  """
231
  )
232
 
233
- st.write('**Effective uses of "you"**')
234
  st.markdown(
235
  """
236
- - You Might Be Using Your Hearing and You Don't Even Know It
237
- - How to Pitch a 4-Day Workweek to Your Boss
 
238
  """
239
  )
240
 
241
  st.write("**Negative headlines**")
242
- st.write("Tip: Negative headlines often outperform positive ones")
243
  st.markdown(
244
  """
245
  - Six Habits of Deeply Happy People -> Six Habits of Deeply Miserable People
@@ -248,61 +266,51 @@ st.markdown(
248
  """
249
  )
250
 
251
- st.write("**Offer unconventional wisdom.**")
252
  st.markdown(
253
  """
254
- - Your Life Is Full of Porn. Stop Getting Yourself Off
255
- - How to Quietly Get People’s Attention in a Noisy World
256
- - Lessons from a Billionaire Who Can’t Focus on Anything for More than 4 Hours
257
  """
258
  )
259
 
260
- st.write(
261
- "**Controversial and divisive**"
262
- ) # TODO maybe remove, validate with other rules
263
- st.markdown(
264
- """
265
- - You Will Destroy Yourself Financially If You Save
266
- - Pepsi’s $32 Billion Typo Caused Deadly Riots
267
- - 11 Things Socially Aware People Don’t Say
268
- """
269
- )
270
 
271
- st.write("**Assertive**")
272
  st.markdown(
273
  """
274
- - Can Your Fitbit Predict the Flu? -> Your Fitbit Might Be Able to Predict the Flu
275
- - Alaska's Swimsuit Scandal Unfairly Polices Young Girls' Bodies
276
- - Meghan Markle Defeated the British Monarchy
277
  """
278
  )
279
 
280
- st.write("**Concise**")
281
  st.markdown(
282
  """
283
- - Your Office Chair Is Hurting You
284
- - Our Skulls Are Out-Evolving Us
285
- - Yes, She's Cheating On You
286
  """
287
  )
288
 
289
- st.write("**Share practical life advice that puts Universities to shame**")
290
- st.markdown(
291
- """
292
- - A Behind the Scenes Look at My Writing Schedule That’s Helped Write 5000+ Articles
293
- - Steve Jobs Advice Turned This Programmer Into A Billionaire
294
- - 8 Really Small Things That Tell You a Lot About Someone
295
- """
296
- )
 
 
 
297
 
298
  # 4 Actions DONE
299
  st.subheader("Actions:")
300
  st.checkbox(
301
- "Share the headline with someone you trust and see what they think the story is about."
302
  )
303
- st.checkbox("Give them a few options and tell them to make a choice.")
304
  st.checkbox(
305
- "When published, look at what people are saying when they share the article."
306
  )
307
 
308
  # 5 Sources DONE
@@ -311,11 +319,11 @@ st.markdown(
311
  """[”How to Write a Headline” by Medium Creators](https://medium.com/creators-hub/how-to-write-a-headline-a72ab3449150)"""
312
  )
313
  st.markdown(
314
- """[”5 Majestic Headline Secrets from Medium’s Most Viral Writers” by Nick Waghorn](https://bettermarketing.pub/5-majestic-headline-secrets-from-mediums-most-viral-writers-506753732dc9)"""
315
  )
316
  st.markdown(
317
  """[”23 Examples of Effective Headlines” by Nadia Rawls](https://medium.com/creators-hub/23-examples-of-effective-headlines-2e7f753476f1)"""
318
  )
319
  st.markdown(
320
- """[”How to Write a Compelling Headline That Isn’t Clickbait” by Medium Creators](https://medium.com/creators-hub/how-to-write-a-compelling-headline-that-isnt-clickbait-7cb816cec438)"""
321
  )
 
8
  nltk.download("punkt")
9
  spell = SpellChecker()
10
 
11
+ st.title("Medium Headline Guidelines")
12
+ st.caption("Turned into an interactive app")
13
 
14
 
15
+ st.subheader("Start with typing your headline idea")
16
+ headline = st.text_input(
17
+ "",
18
+ "7 Steps How To NOT Make an Oak Coffee Table",
19
+ )
20
+
21
+ st.markdown("---")
22
 
23
  # TODO
24
  # """
25
  # MVP
26
  # - keep merging guidelines
27
+ # - clean up helps
28
+ # - ask sources' authors for permission (or rephrase)
29
  # - ask Danni for help
30
 
31
+ # Workshopping:
32
  # - try to write a headline with that tool
33
  # - use columns or expander to organise that
34
+ # - fill help when possible, for types too
35
  # - ask in Facebook/reddit group/privs Medium Wroters/bloggers for feedback!
36
  # - own domain (host on Streamlit)
37
 
38
  # Features:
39
+ # - consider turning examplary headlines into links
40
  # - bloom few shot for high-level guidelines
41
  # - train paraphraser to specific types
42
  # - BERT for suprise metric
 
46
  # """
47
 
48
  # 1 Substantial guidelines
49
+ st.subheader("Substantial guidelines")
50
+ st.write("**Make sure your headline answers the ultimate questions:**")
51
  st.checkbox("What the story is about?")
52
  st.checkbox(
53
  "Why the story matters to a reader?"
54
+ ) # TODO does examplary headlines really answer that? maybe in sub-headlines, I don't get it but looks important, read more
55
 
56
+ st.write("**Make sure the headline is:**")
57
 
58
  ### interesting
59
  st.checkbox("focused on what is most interesting")
 
78
  help="Avoid jargon, and think of what makes sense in casual conversation. Know the language that your audience is familiar with.",
79
  )
80
  st.checkbox(
81
+ "**Deliver on your promises**",
82
  help="You’re building a relationship with your readers. The headline sets the expectations, and the story must deliver on that.",
83
  )
84
  st.checkbox(
85
+ "Don’t ask a question unless you know the answer",
86
  help="You’re building a relationship with your readers. The headline sets the expectations, and the story must deliver on that.",
87
  )
88
  st.checkbox(
89
+ "If you want to be poetic or clever in your headline, follow it up with a strong subheadline",
90
  help="You may want to be poetic, clever, or artistic in the title. The challenge with crafting a title this way is that it becomes opaque. It’s also much easier to write a bad title when striving for something poetic or clever than if you’re going for clarity. In most cases, the reader won’t click to find out more because they didn’t understand what the story was about in the first place.",
91
  )
92
 
93
+ st.write("**Guiding questions to consider:**")
94
  st.checkbox(
95
  "Make it clear. Could the headline be clearer?"
96
  ) # there is such type (is it rule along others or individual style)
 
118
  help="“Be aware of who is in the room writing the headline and what the limits of their perspective might be,” shares Rawls. Often biases will show up in the adjectives you use, so double-check the ones you use, and consider what they may unintentionally express.",
119
  )
120
 
121
+ # 2 Editorial guidelines DONE
122
+ st.subheader("Editorial Guidelines")
123
+ st.checkbox("Use Title Case (NEVER ALL CAPS)") # implement warning?
 
 
 
 
 
 
124
  # alpha_chars = [c for c in headline if c.isalpha()]
125
  # upper_chars = [c for c in alpha_chars if c.isupper()]
126
  # upper_ratio = upper_chars / alpha_chars
127
  # is_mostly_upper = upper_ratio > 0.8
128
  # TODO show is_mostly_upper
129
 
130
+ st.checkbox("Fix typos") # red -> green, Spacy
131
+ # TODO try https://pypi.org/project/language-tool-python/
132
  # if headline:
133
  # ll = [
134
  # [word_tokenize(w), " "] for w in headline.split()
 
142
  # "Especially consider:"
143
  # st.info(headline)
144
 
145
+ st.checkbox("Remove links") # implement warning with regex
146
+ st.checkbox( # implement
147
+ "Avoid gerunds (-ing words)",
148
+ help="People are 70% more likely to click on the nongerund headlines",
149
+ )
150
+ st.checkbox( # implement
151
+ "Avoid one-word or two-word headlines",
152
+ help="Don’t write a headline like you would a book title",
153
+ )
154
 
155
+ # 3 Proven Headline Types DONE
156
 
157
  st.subheader("Proven Headline Types")
158
+
159
  st.write("**Analysis**")
160
  st.markdown(
161
  """
 
180
  """
181
  )
182
 
183
+ st.write("**Assertive**")
184
+ st.markdown(
185
+ """
186
+ - Alaska's Swimsuit Scandal Unfairly Polices Young Girls' Bodies
187
+ - Meghan Markle Defeated the British Monarchy
188
+ - Can Your Fitbit Predict the Flu? -> Your Fitbit Might Be Able to Predict the Flu
189
+ """
190
+ )
191
+
192
  st.write("**Descriptive teaser**")
193
  st.markdown(
194
  """
 
209
  """
210
  )
211
 
212
+ st.write("**Clear promises**")
 
 
 
213
  st.markdown(
214
  """
215
+ - How to Talk To an Employee Obsessed With Promotion
216
+ - An Embarassing Story Is a Secret Weapon to Work
217
  """
218
  )
219
 
220
+ st.write("**Concise**")
221
  st.markdown(
222
  """
223
+ - Your Office Chair Is Hurting You
224
+ - Our Skulls Are Out-Evolving Us
225
+ - Yes, She's Cheating On You
226
  """
227
  )
228
 
229
+ st.write("**Benefit-based**")
230
+ st.caption(
231
+ "Tip: The key to writing a tempting benefit-based headline is to be specific"
 
 
232
  )
 
 
233
  st.markdown(
234
  """
235
+ - How to Wake Up Smiling: The 9 Decisions That Led To A Life I Love
236
+ - This 3-Minute Exercise Will Change the Way You Solve Problems
237
+ - How I Doubled My Writing Income Overnight By Focusing on One Skill
238
  """
239
  )
240
 
241
+ st.write("**Unconventional wisdom**")
242
  st.markdown(
243
  """
244
+ - Your Life Is Full of Porn. Stop Getting Yourself Off
245
+ - How to Quietly Get People’s Attention in a Noisy World
246
+ - Lessons from a Billionaire Who Can’t Focus on Anything for More than 4 Hours
247
  """
248
  )
249
 
250
+ st.write("**Promising life advice**")
251
  st.markdown(
252
  """
253
+ - A Behind the Scenes Look at My Writing Schedule That’s Helped Write 5000+ Articles
254
+ - Steve Jobs Advice Turned This Programmer Into A Billionaire
255
+ - 8 Really Small Things That Tell You a Lot About Someone
256
  """
257
  )
258
 
259
  st.write("**Negative headlines**")
260
+ st.caption("Tip: Negative headlines often outperform positive ones")
261
  st.markdown(
262
  """
263
  - Six Habits of Deeply Happy People -> Six Habits of Deeply Miserable People
 
266
  """
267
  )
268
 
269
+ st.write("**Personal headlines**")
270
  st.markdown(
271
  """
272
+ - It's 2020, And I Had to Leave My Home Because of the KKK
 
 
273
  """
274
  )
275
 
276
+ st.write("**Quote**")
277
+ st.markdown("- Mom, Why Don’t You Have Any Black Friends?")
 
 
 
 
 
 
 
 
278
 
279
+ st.write("**Validate readers’ feelings**")
280
  st.markdown(
281
  """
282
+ - In Defense of the Super Low-Key Workout
 
 
283
  """
284
  )
285
 
286
+ st.write("**Coining terms**")
287
  st.markdown(
288
  """
289
+ - When Black Women Go From Office Pet to Office Threat
290
+ - Nazi Hippies: When the New Age and Far Right Overlap
 
291
  """
292
  )
293
 
294
+
295
+ # st.write(
296
+ # "**Controversial and divisive**"
297
+ # ) # TODO maybe remove, validate with other rules
298
+ # st.markdown(
299
+ # """
300
+ # - You Will Destroy Yourself Financially If You Save
301
+ # - Pepsi’s $32 Billion Typo Caused Deadly Riots
302
+ # - 11 Things Socially Aware People Don’t Say
303
+ # """
304
+ # )
305
 
306
  # 4 Actions DONE
307
  st.subheader("Actions:")
308
  st.checkbox(
309
+ "Share the headline with someone you trust and see what they think the story is about"
310
  )
311
+ st.checkbox("Give them a few options and tell them to make a choice")
312
  st.checkbox(
313
+ "When published, look at what people are saying when they share the article"
314
  )
315
 
316
  # 5 Sources DONE
 
319
  """[”How to Write a Headline” by Medium Creators](https://medium.com/creators-hub/how-to-write-a-headline-a72ab3449150)"""
320
  )
321
  st.markdown(
322
+ """[”How to Write a Compelling Headline That Isn’t Clickbait” by Medium Creators](https://medium.com/creators-hub/how-to-write-a-compelling-headline-that-isnt-clickbait-7cb816cec438)"""
323
  )
324
  st.markdown(
325
  """[”23 Examples of Effective Headlines” by Nadia Rawls](https://medium.com/creators-hub/23-examples-of-effective-headlines-2e7f753476f1)"""
326
  )
327
  st.markdown(
328
+ """[”5 Majestic Headline Secrets from Medium’s Most Viral Writers” by Nick Waghorn](https://bettermarketing.pub/5-majestic-headline-secrets-from-mediums-most-viral-writers-506753732dc9)"""
329
  )