https://github.com/accelbyte/profanity-filter-go
https://github.com/accelbyte/profanity-filter-go
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/accelbyte/profanity-filter-go
- Owner: AccelByte
- License: apache-2.0
- Created: 2020-04-28T06:23:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-23T02:42:09.000Z (about 3 years ago)
- Last Synced: 2024-06-20T05:13:43.246Z (almost 2 years ago)
- Language: Go
- Size: 56.6 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# profanity-filter-go
Profanity filter to check if a message contains blacklisted words
# usage
```go
package main
import (
"fmt"
filter "github.com/AccelByte/profanity-filter-go"
)
func main() {
isBadWord, badWordFound, err := filter.ProfanityCheck("fuck")
fmt.Println("Bad words found: ", isBadWord)
fmt.Println("Bad words tripped: ", badWordFound)
fmt.Println("Error: ", err)
}
```
### Output
```
> go run main.go
Bad words found: true
Bad words tripped: [fuck]
Error:
```
### Generates list of profanity list from json file to array in go language code
1. Run file main.go under directory `/profanity-filter-go/profanitylist/generator/main.go`
```go run main.go```
2. This script unmarshal the json files and generates as array variable in golang format.
This script diplays the result in terminal.
Example result:
```go
var frenchCAProfanityList = profanityList{
Country: "frenchCA",
BadWordList: []string{"noune", "osti", "criss", "crisse", "calice", "tabarnak", "viarge"},
}
var klingonProfanityList = profanityList{
Country: "klingon",
BadWordList: []string{"ghuy'cha'", "QI'yaH", "Qu'vatlh"},
}
```
3. Copy the result as array variable profanity list in `profanity-filter-go/profanitylist.go`