An API made for you

The cucco API is organized around public and private endpoints. The API is predictable, has function-oriented URLs, and uses HTTP response codes to indicate API errors. It uses built-in HTTP features, like HTTP authentication and HTTP verbs, which are understood by off-the-shelf HTTP clients. It supports api key/secret authentication, allowing you to interact securely with our API from a client-side. JSON is returned by all API responses, including errors. All normalization endpoints support both GET and POST methods.

/api/v1/accents

Removes accent marks in the text.

Attributes

text required string Text from where to remove accent marks.

Example request:

$ curl http://cucco.io/api/v1/accents \
    -d text="¿Quién dejó al cucco fuera?"
 

Example response:

{
    "text": "¿Quien dejo al cucco fuera?"
}

/api/v1/characters

Removes specific characters from the input text or replaces them with a specified string.

Attributes

text required string Text from which characters will be removed or replaced.
characters required string String containing the characters to replace. The string doesn't have to be comma separated.
replacement string, defaults to empty New text that will replace the characters.

Example request:

$ curl http://cucco.io/api/v1/characters \
    -d text="Who let the cucco out?" \
    -d characters="lt" \
    -d replacement="X"
 

Example response:

{
    "characters": "lt",
    "replacement": "X",
    "text": "Who XeX Xhe cucco ouX?"
}

/api/v1/emails

Removes email addresses from the input text or replaces them with a specified string.

Attributes

text required string Text from which email addresses will be removed or replaced.
replacement string, defaults to empty New text that will replace email addresses.

Example request:

$ curl http://cucco.io/api/v1/emails \
    -d text="Support email address -> support@cucco.io" \
    -d replacement="X"
 

Example response:

{
    "replacement": "X",
    "text": "Support email address -> X"
}

/api/v1/emojis

Removes emojis from the input text, or replaces them with a specified string.

Attributes

text required string Text from which emojis will be removed or replaced.
replacement string, defaults to empty New text that will replace emojis.

Example request:

$ curl http://cucco.io/api/v1/emojis \
    -d text="Cuccos 🐔 cuccos 🐔 everywhere" \
    -d replacement="X"
 

Example response:

{
    "replacement": "X",
    "text": "Cuccos X cuccos everywhere X"
}

/api/v1/hyphens

Replaces hyphens from the input text with a white space or a specified string.

Attributes

text required string Text from which hyphens will be removed or replaced.
replacement string, defaults to " " New text that will replace hyphens.

Example request:

$ curl http://cucco.io/api/v1/hyphens \
    -d text="Cucco phone numer is 555-1234" \
    -d replacement="X"
 

Example response:

{
    "replacement": "X",
    "text": "Cucco phone numer is 555X1234"
}

/api/v1/normalize

Applies a list of normalizations to the given text. If no normalizations are defined, the default ones will be used.

Attributes

text required string The text to be processed.
normalizations object, optional List of normalizations to apply. The format for this list is similar to the one used in the library but respecting JSON rules.

Example request:

$ curl http://cucco.io/api/v1/normalize \
    -H "Content-Type: application/json" -d '{
        "text": "Who    let the ; cucco    out?",
        "normalizations": [
            [
                "replace_punctuation",
                {
                    "replacement": "X"
                }
            ],
            "remove_extra_whitespaces"
        ]
    }'

Example response:

{
    "normalizations": [
        [
            "replace_punctuation",
            {
                "replacement": "X"
            }
        ],
        "remove_extra_whitespaces"
    ],
    "text": "Who let the X cucco outX"
}

/api/v1/punctuation

Removes punctuation from the input text or replaces them with a string if specified.

Attributes

text required string The text to be processed.
excluded list, defaults to none List of characters to exclude.
replacement string, defaults to empty New text that will replace punctuation.

Example request:

$ curl http://cucco.io/api/v1/punctuation \
    -d text="Support email address -> support@cucco.io 🐔" \
    -d excluded="-@" \
    -d replacement="X"
 

Example response:

{
    "excluded": [
        "-",
        "@"
    ],
    "replacement": "X",
    "text": "Support email address -X support@cuccoXio 🐔"
}

/api/v1/status

Returns the status of the API.

Example request:

$ curl http://cucco.io/api/v1/status
 

Example response:

{
    "status": "ok"
}

/api/v1/stopwords

Removes stop words from the text. The dataset and language codes can be found in GitHub.

Attributes

text required string The text to be processed.
ignore_case boolean, defaults to true Whether or not to ignore case.
language string, defaults to "en" Code of the language to use.

Example request:

$ curl http://cucco.io/api/v1/stopwords \
   -d text="Who let the cucco out" \
   -d ignore_case="true" \
   -d language="en"
 

Example response:

{
    "ignore_case": true,
    "language": "en",
    "text": "cucco"
}

/api/v1/symbols

Removes symbols from the input text or replaces them with a specified string.

Attributes

text required string Text from which symbols will be removed or replaced.
form string, defaults to NFKD Unicode form. Valid values are 'NFC,' 'NFKC,' 'NFD,' and 'NFKD.'
excluded list, defaults to none List of unicode characters to exclude.
replacement string, defaults to empty New text that will replace symbols.

Example request:

$ curl http://cucco.io/api/v1/symbols \
   -d text="Who let the cucco out (ñ)" \
   -d form="NFKD" \
   -d replacement="X"
 

Example response:

{
    "form": "NFKD",
    "replacement": "X",
    "text": "Who let the cucco out (nX)"
}

/api/v1/urls

Removes URLs from the input text or replaces them with a string if specified.

Attributes

text required string Text from which urls will be removed or replaced.
replacement string, defaults to empty New text that will replace urls.

Example request:

$ curl http://cucco.io/api/v1/urls \
   -d text="Get cucco from http://cucco.io" \
   -d replacement="X"
 

Example response:

{
    "replacement": "X",
    "text": "Get cucco from X"
}

/api/v1/whitespaces

Removes white spaces from the beginning and the end of the string, as well as duplicated white spaces between words.

Attributes

text required string Text from which extra whitespaces will be removed.

Example request:

$ curl http://cucco.io/api/v1/whitespaces \
   -d text="Who    let the cucco    out?"
 

Example response:

{
    "text": "Who let the cucco out?"
}