# Text Summariser

The goal of this activity is to create a script which will accept a block of text as input and summarise the text based on our algorithm. The algorithm that we will use to do this is outlined below:

1. Break our text into sentences
2. Break out sentences into words
3. filter out stopwords (a starter list of stopwords will be provided)
4. normalise the words
   1. remove any punctuation
   2. make everything lowercase
5. index how many instances of each word we have
6. iterate through the sentences
   1. assign each sentence a base score according to how early it appears in the text (earlier sentences are weighted higher)
   2. add to the base score according to the cumulative scores of all of the words in the sentence (we will use our index for this)
   3. store the sentence and its score
7. fetch the 5 highest scoring sentences
8. display them

This basic algorithm will provide us with a summary of the input text based on how frequently words in the sentence appeared, and how early the sentence occurred.&#x20;

Let's get started 🚀


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learning.pavey.dev/javascript/activities/text-summariser.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
