Skip to content

Flask API that filters texts into word vectors filtered by the occurrence of unique words inside the text.

Notifications You must be signed in to change notification settings

pythonbyte/word-counter-api

Repository files navigation

Description

Flask API that filters texts into word vectors filtered by the occurrence of unique words inside the text. The program will clean the input text, removing punctuation, strings that begin with number and remove stop words. The app is alphabetically ordered.

POST is the only method allowed.

Endpoint

This endpoint works at the /. Receives a object({}) with key as 'texts' and an array as value.

Post: '/'

{
	"texts": ["Falar é fácil. Mostre-me o código."]
}

Response

{
    "unique_words": [
        "código",
        "falar",
        "fácil",
        "mostre"
    ],
    "word_count": {
        "0": [
            1,
            1,
            1,
            1
        ]
    }
}

Parameter

This endpoint receive a ngrams parameter, that will separate the input text into the number passed as parameter

Post: '/?ngrams=2'

{
	"texts": ["Falar é fácil. Mostre-me o código."]
}

Response

{
    "unique_words": [
        "falar é",
        "fácil mostre",
        "me o",
        "mostre me",
        "o código",
        "é fácil"
    ],
    "word_count": {
        "0": [
            1,
            1,
            1,
            1,
            1,
            1
        ]
    }
}

Post: '/?ngrams=3'

{
	"texts": ["Falar é fácil. Mostre-me o código."]
}

Response

{
    "unique_words": [
        "falar é fácil",
        "fácil mostre me",
        "me o código",
        "mostre me o",
        "é fácil mostre"
    ],
    "word_count": {
        "0": [
            1,
            1,
            1,
            1,
            1
        ]
    }
}

About

Flask API that filters texts into word vectors filtered by the occurrence of unique words inside the text.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages