Skip to content

Instantly share code, notes, and snippets.

@brienna
Last active May 25, 2020 20:24
Show Gist options
  • Save brienna/ed78130b3534ff422330956fe595e072 to your computer and use it in GitHub Desktop.
Save brienna/ed78130b3534ff422330956fe595e072 to your computer and use it in GitHub Desktop.
Generates headlines about a specific topic such as the coronavirus
total = 25
topic = ['coronavirus', 'covid19', 'covid-19', 'sars-cov-2', 'sarscov2', 'sars-cov2', 'virus', 'pandemic']
generated_headlines = []
while len(generated_headlines) < total:
headline = model.make_sentence()
if headline is not None:
on_topic = bool([word for word in headline.split(' ') if word.lower() in topic])
if on_topic:
generated_headlines.append(headline)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment