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

chore: organise content into 5 main categories

Browse files
Files changed (1) hide show
  1. app.py +178 -93
app.py CHANGED
@@ -9,86 +9,92 @@ nltk.download("punkt")
9
  spell = SpellChecker()
10
 
11
  st.title("Medium Headline")
12
- st.caption(
13
- "The most important Medium Headline writing articles turned into an interactive app."
14
- )
15
- ""
16
- ""
17
- ""
18
- ""
19
 
20
  st.header("Start with typing your headline idea")
21
- headline = st.text_input(
22
- "",
23
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
- # TODO keep merging guidelines
26
- # TODO Use columns or expander to organise that
27
- # TODO try to write a headline with that tool
28
- # TODO ask in Facebook/reddit group/privs Medium Wroters/blohgers for feedback!
29
- # TODO bloom few shot, BERT for surprise metric, train to paraphrase to specific types?
30
- # TODO maybe using markdown's H1-6 will result in better spacing
31
- # TODO split to the most important quidelined (answear question, few traits, auto editing features) and expandable/on button click advanced guidelines
32
 
33
- st.header("Then follow below guidelines")
 
34
  st.subheader("Make sure your headline answers the ultimate questions:")
35
  st.checkbox("What the story is about?")
36
- st.checkbox("Why the story matters?")
 
 
37
 
38
  st.subheader("Make sure the headline is:")
 
 
39
  st.checkbox("focused on what is most interesting")
40
- Is it interesting? Make it interesting
41
  st.checkbox(
42
  "Focus on what’s interesting.",
43
  help="Be straightforward about why a reader should read the article. Don’t bury or hide this.",
44
  )
45
- Focus on what’s interesting. Your headline doesn’t need to address everything that’s in your story.
46
- It just needs to focus on the most interesting part of your story in a way that represents the overall truth of your story.
 
47
 
48
- st.subheader("Follow below principles:")
49
- st.checkbox( # (trait or individual style?)
50
- "Be direct.",
51
  help="Your story is among many a reader is browsing. Be straightforward in what it is about.",
52
  )
53
  "How To Become Popular Without Being Charming, Funny, or Outgoing"
54
  "How Google Earth Mapped 98% of the World"
55
 
56
- st.checkbox(
57
- "Use conventional language.",
58
  help="Avoid jargon, and think of what makes sense in casual conversation. Know the language that your audience is familiar with.",
59
  )
60
  st.checkbox(
61
  "Deliver on your promises.",
62
  help="You’re building a relationship with your readers. The headline sets the expectations, and the story must deliver on that.",
63
  )
 
 
 
 
64
  st.checkbox(
65
  "If you want to be poetic or clever in your headline, follow it up with a strong subheadline.",
66
  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.",
67
  )
68
 
69
  st.subheader("Guiding questions to consider:")
70
- st.checkbox("Make it clear. Could the headline be clearer?") # there is such type (is it rule along others or individual style)
 
 
71
  st.checkbox("Is the headline specific enough?")
72
  st.checkbox("Does the tone reflect the voice or point of view of the article?")
73
  st.checkbox("How might the headline convey what is unique about the story?")
74
- st.checkbox("Is it true? Make it true. Don't overpromise. Is the headline honest about what the story offers the reader?")
75
-
76
- st.subheader("Avoid:")
77
- st.checkbox("all caps") # implement warning?
78
- st.checkbox("all typos") # implement separately?
79
- if headline:
80
- ll = [[word_tokenize(w), " "] for w in headline.split()]
81
- tokens = list(itertools.chain(*list(itertools.chain(*ll))))
82
- tokens = [
83
- spell.correction(t) if spell.unknown([t]) and t != " " else t for t in tokens
84
- ]
85
- headline = "".join(tokens)
86
- headline = titlecase(headline)
87
- "Especially consider:"
88
- st.info(headline)
89
 
90
- st.checkbox("links") # implement warning with regex
91
- st.checkbox("profanity") # implement?
92
  st.checkbox("exaggeration")
93
  st.checkbox("mystery")
94
  st.checkbox(
@@ -103,35 +109,43 @@ st.checkbox(
103
  "biases",
104
  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.",
105
  )
106
- "Easy on the gerunds (-ing words)." # TODO implement check
107
- "Don’t write a headline like you would a book title (avoid one-word or two-word headlines)." # TODO implement check
108
- # Don’t ask a question unless you know the answer.
109
-
110
- "In the short term this may help drive traffic, but in the long term it undermines your integrity as a writer."
111
 
112
- st.subheader("Viral tips:")
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
- st.checkbox(
118
- "Negative headlines outperform positive ones.",
119
- help="“Six Habits of Deeply Happy People“\n“7 Things You Should Do in the Morning“\n“A Rarely Mentioned Relationship Virtue That Strengthens Couples“\n\nV.S\n\n“Six Habits of Deeply Miserable People”\n“7 Things You Should Never Do in the Morning“\n“A Rarely Mentioned Relationship Sin That Bulldozes Couples”",
120
- )
121
- st.checkbox(
122
- "Offer unconventional wisdom.",
123
- help="“Six Habits of Deeply Happy People“\n“7 Things You Should Do in the Morning“\n“A Rarely Mentioned Relationship Virtue That Strengthens Couples“\n\nV.S\n\n“Six Habits of Deeply Miserable People”\n“7 Things You Should Never Do in the Morning“\n“A Rarely Mentioned Relationship Sin That Bulldozes Couples”",
124
- )
125
- st.checkbox(
126
- "Make it controversial and divisive.",
127
- help="Here are a few perfect examples:\n“You Will Destroy Yourself Financially If You Save”\n“Pepsi’s $32 Billion Typo Caused Deadly Riots”\n“11 Things Socially Aware People Don’t Say”",
128
- ) # TODO explain it is in opposite to Meodum guidelines
129
- st.checkbox(
130
- "Share practical life advice that puts Universities to shame.",
131
- help="“A Behind the Scenes Look at My Writing Schedule That’s Helped Write 5000+ Articles”\n“Steve Jobs Advice Turned This Programmer Into A Billionaire”\n“8 Really Small Things That Tell You a Lot About Someone”",
132
- )
133
 
134
- st.subheader("Headline categories for inspiration")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  st.write("**Analysis**")
136
  st.markdown(
137
  """
@@ -187,41 +201,112 @@ st.markdown(
187
  """
188
  )
189
 
190
- Personal headlines
191
- It's 2020, And I Had to Leave My Home Because of the KKK
 
 
 
 
192
 
193
- Validate readers’ feelings
194
- In Defense of the Super Low-Key Workout
 
 
 
 
195
 
196
- Clear promises
197
- How to Talk To an Employee Obsessed With Promotion
198
- An Embarassing Story Is a Secret Weapon to Work
 
 
 
 
199
 
200
- Effective use of “I
201
- How I Accidentally Wound Up Running an Outlaw Bigger Gang in Ohio
 
 
 
 
202
 
203
- Effective uses of "you"
204
- You Might Be Using Your Hearing and You Don't Even Know It
205
- How to Pitch a 4-Day Workweek to Your Boss
 
 
 
 
206
 
207
- General guidelines
 
 
 
 
 
 
 
 
208
 
209
- Don’t make the reader work. Or even think, really. Headlines should deliver all the information a reader needs for deciding whether they should dive into your story.
210
- Use the right language for your audience. If you’re writing for a general audience, no jargon! Pick three friends: Would each of them know what your story is about based on the headline? If so, you have a great headline.
211
- Answer: So what? Why now? Why does your story matter? Why does it matter to a reader right now?
 
 
 
 
 
212
 
213
- Is it concise? Make it concise Omit unnecessary words
214
- Is it assertive? Make it assertive (trait or individual style?)
215
- Assertive headlines
216
- Your Fitbit Might Be Able To Predict the Flu?
217
- Would my really smart friend click on it?
 
 
 
 
 
218
 
219
- st.subheader("Consider below actions:") # OK
220
- st.checkbox("Share the headline with someone you trust and see what they think the story is about.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  st.checkbox("Give them a few options and tell them to make a choice.")
222
- st.checkbox("When published, look at what people are saying when they share the article.")
 
 
223
 
224
- st.header("Sources:") # OK
 
225
  st.markdown(
226
  """[”How to Write a Headline” by Medium Creators](https://medium.com/creators-hub/how-to-write-a-headline-a72ab3449150)"""
227
  )
 
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
35
 
36
+ # Design:
37
+ # - check out H1-6 instead of Streamlit's header/subheader
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")
52
+ # Is it interesting? Make it interesting
53
  st.checkbox(
54
  "Focus on what’s interesting.",
55
  help="Be straightforward about why a reader should read the article. Don’t bury or hide this.",
56
  )
57
+ # Focus on what’s interesting. Your headline doesn’t need to address everything that’s in your story.
58
+ # It just needs to focus on the most interesting part of your story in a way that represents the overall truth of your story.
59
+ ### interesting
60
 
61
+ st.checkbox( # (trait or individual style?)
62
+ "Direct",
 
63
  help="Your story is among many a reader is browsing. Be straightforward in what it is about.",
64
  )
65
  "How To Become Popular Without Being Charming, Funny, or Outgoing"
66
  "How Google Earth Mapped 98% of the World"
67
 
68
+ st.checkbox( # TODO it's optional depending on the audience
69
+ "Uses conventional language (if for a general 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)
89
  st.checkbox("Is the headline specific enough?")
90
  st.checkbox("Does the tone reflect the voice or point of view of the article?")
91
  st.checkbox("How might the headline convey what is unique about the story?")
92
+ st.checkbox(
93
+ "Is it true? Make it true. Don't overpromise. Is the headline honest about what the story offers the reader?"
94
+ )
 
 
 
 
 
 
 
 
 
 
 
 
95
 
96
+ # TODO most of them below are extras/obvious
97
+ st.checkbox("profanity")
98
  st.checkbox("exaggeration")
99
  st.checkbox("mystery")
100
  st.checkbox(
 
109
  "biases",
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()
132
+ # ] # TODO split whitespaces with regex to keep full whitespaces
133
+ # tokens = list(itertools.chain(*list(itertools.chain(*ll))))
134
+ # tokens = [
135
+ # spell.correction(t) if spell.unknown([t]) and t != " " else t for t in tokens
136
+ # ]
137
+ # headline = "".join(tokens)
138
+ # headline = titlecase(headline)
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
  """
 
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
246
+ - 7 Things You Should Do in the Morning -> 7 Things You Should Never Do in the Morning
247
+ - A Rarely Mentioned Relationship Virtue That Strengthens Couples -> A Rarely Mentioned Relationship Sin That Bulldozes Couples
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
309
+ st.subheader("Sources:")
310
  st.markdown(
311
  """[”How to Write a Headline” by Medium Creators](https://medium.com/creators-hub/how-to-write-a-headline-a72ab3449150)"""
312
  )