is a RestFull APIs for filtering profanity by using Levenshtein Distance algorithm. Built with Vanilla JavaScript and combined using Hapi Framework for making APIs. It allows you to build a website for blocking the harsh words.
- Put your sentences or paragraph.
- Your sentences or paragraph will split into an array.
- Do filtering on the same word.
- Do filtering on the exception data.
- Do Levenshtein Distance algorithm.
- Return the result of Levenshtein Distance algorithm.
Payload | Status |
---|---|
merge | Boolean default (false) |
sentence | String required |
inclusion | Array not required |
exclusion | Array not required |
Method | Path |
---|---|
POST | https://project-app-forum.herokuapp.com/api/v1/filter?merge=true |
{
"status": "success",
"data": {
"result": {
"merge": true,
"free_profanity_score": 100,
"words_count": 3,
"found": 0,
"warning": 0,
"index_array": [],
"index_arr_warning": [],
"initial_sentence": "Levenshtein Distance Checker",
"new_sentence": "Levenshtein Distance Checker"
}
}
}
const regex = /([.,!:;"'])/gi;
const result = sentence.replace(regex, "$1 ").split(" ").filter((item) => { if (item !== "") { return item } });