This application provides a user interface and API for the RSLP (Portuguese Language Suffix Remover) algorithm, which is used to remove suffixes from Portuguese words in applications such as search engines, text analysis, and natural language processing.
flowchart LR
Client([User]) -->|HTTP Request| Nginx(Nginx Proxy)
Nginx -->|/ requests| Frontend[SvelteKit Frontend]
Nginx -->|/api requests| Backend[RSLP Stemmer API]
Frontend -->|POST /api/stem| Nginx
Backend -->|Stemming Process| RSLPRules[(RSLP Rules)]
subgraph Docker Compose
Nginx
Frontend
Backend
RSLPRules
end
This flowchart illustrates the steps involved in the RSLP algorithm for stemming Portuguese words, based on this article: RSLP Stemmer (Removedor de Sufixos da Lingua Portuguesa):
flowchart LR
Start([Begin]) --> wordEndsInPlural{Word ends in "s"?}
wordEndsInPlural -- Yes --> pluralReduction[Plural Reduction]
wordEndsInPlural -- No --> wordEndsInFeminine{Word ends in "a"?}
pluralReduction --> wordEndsInFeminine
wordEndsInFeminine -- Yes --> feminineReduction[Feminine Reduction]
wordEndsInFeminine -- No --> augmentativeDiminutive{Word ends in "ão" or "inho"?}
feminineReduction --> augmentativeDiminutive
augmentativeDiminutive --> adverbReduction[Adverb Reduction]
adverbReduction --> nounSuffixReduction[Noun Reduction]
nounSuffixReduction --> isSuffixRemoved{Suffix removed}
isSuffixRemoved -- Yes --> removeAccents[Remove Accent]
isSuffixRemoved -- No --> verbSuffixReduction[Verb Reduction]
verbSuffixReduction --> isSuffixRemoved2{Suffix removed}
isSuffixRemoved2 -- Yes --> removeAccents
isSuffixRemoved2 -- No --> removeVowel[Remove Vowel]
removeVowel --> removeAccents
removeAccents --> final([End])
The application was built with Docker in mind. To run the application, you need to have Docker installed on your machine. After installing Docker, you can follow these steps:
docker compose up -d
This will start the application in the background. After that, you can access the application through your browser at http://localhost.
GET /
The main web interface where you can interactively test the RSLP algorithm by entering Portuguese words and seeing their stemmed results.
POST /api/stem
Stems a Portuguese word by removing its suffixes according to the RSLP algorithm.
Request Body:
{
"text": "string"
}
Parameters:
Name | Type | Required | Description |
---|---|---|---|
text | string | Yes | The word to be stemmed |
Response:
{
"original": "string",
"stemmed": "string"
}
Request:
curl -X POST http://localhost/api/stem \
-H "Content-Type: application/json" \
-d '{"text": "caminhando"}'
Response:
{
"original": "caminhando",
"stemmed": "caminh"
}
Request:
curl -X POST http://localhost/api/stem \
-H "Content-Type: application/json" \
-d '{"text": "brasileiros aprendendo português"}'
Response:
{
"original": "brasileiros aprendendo português",
"stemmed": "brasil aprend portug"
}
The RSLP (Removedor de Sufixos da Língua Portuguesa) algorithm reduces Portuguese words to their stem form by removing suffixes through a series of rule-based steps: