Getting the summary
We will first need to sort our ranked sentences by their score. To do this we can use the array sort method and a fairly common numerical comparator.
This will compare the scores and put the entries in the correct order. Once we have done this, all we need to do is take the n
first items, where n
is the number of sentences we want, in this case, I will take 5.
And with that, you should now have a 5 sentence summary of the block of text you provided as input 🎉
Last updated