Last active
May 25, 2020 20:24
-
-
Save brienna/ed78130b3534ff422330956fe595e072 to your computer and use it in GitHub Desktop.
Generates headlines about a specific topic such as the coronavirus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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