Text Summarisation with BERT

Hugging Face provides a wide range of pretrained models for lots of machine learning tasks. Summarising the chapters of our novel - Bleak House - would be an interesting challenge. This could also be a very useful mnemonic technique if you were reviewing a long piece of work. 

So here is the Hugging Face instructions on this.

pip install transformers

Then in python:

from transformers import pipeline

summarizer = pipeline("summarizer")

Give it the text to summarize along with some params

summarizer(ARTICLE, max_length=130, min_length=30, do_sample=False)

BERT is a large model and takes about 15 minutes to download for me. However it is then a pip package and so will be available next time you try to run it. 


Comments

Popular posts from this blog

Using curl scriptlets from a single file in VS Code

Recreating python feature extraction code in JavaScript

Sentiment Analysis based on IMDB Movie Review dataset