This project implements a simple API for summarizing texts using FastAPI and NLTK (Natural Language Toolkit). The main function performs text summarization based on word frequency, returning the most representative sentences.
The summarize function receives a text and a desired number of sentences for the summary. It follows these steps:
First, navigate to the root directory of the project where the docker-compose.yaml file is located. Then, build and start the container using the following command:
docker-compose up --build
This will build the image and start the API application inside a container.
Once the container is running, the API application will be available at:
http://localhost:8400
POST /summarize/
The request must be a JSON containing the following parameters:
text
(string): The text you want to summarize.num_sentences
(integer, optional, default 3): The number of sentences you want in the summary.
{
"text": "Natural language processing (NLP) is a field of computer science and artificial intelligence concerned with the interactions between computers and human language. It focuses on programming computers to fruitfully process large natural language data.",
"num_sentences": 2
}