Skip to content

Instantly share code, notes, and snippets.

@manmohan24nov
Last active November 3, 2020 20:17
Show Gist options
  • Save manmohan24nov/b57b68e96dfa98328f29d6d9f301aafa to your computer and use it in GitHub Desktop.
Save manmohan24nov/b57b68e96dfa98328f29d6d9f301aafa to your computer and use it in GitHub Desktop.
>>> from summarizer import TransformerSummarizer
>>> import re
>>> GPT2_model = TransformerSummarizer(transformer_type="GPT2",transformer_model_key="gpt2-medium")
>>> text = " ".join(tweet_data)
>>> TEXT_CLEANING_RE = "@\S+|https?:\S+|http?:\S|[^A-Za-z0-9]+"
>>> text = re.sub(TEXT_CLEANING_RE, ' ', str(text).lower()).strip()
>>> summerize = ''.join(GPT2_model(text, min_length=60, max_length=120))
>>> summerize
'Overnight show with me and a host of brilliant guests on both sides of the at trump s defeat will expose narendramodi to international censure change in the white house likely to force the in in a choice between a clown and a gaffe prone plagiarist tarred by his son s alleged corruption trump deserves th see a detailed map of'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment