This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increase accuracy by about 1%, improve code.
- Loading branch information
Showing
8 changed files
with
1,756 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"flag" | ||
"github.com/finnbear/moderation" | ||
) | ||
|
||
var input string | ||
|
||
func init() { | ||
flag.StringVar(&input, "input", "", "the input to find an inappropriate phase in") | ||
flag.Parse() | ||
} | ||
|
||
func main() { | ||
shorter := input | ||
for moderation.Is(shorter, 0xffffffff) { // satisfies all bitmasks | ||
input = shorter | ||
shorter = shorter[:len(shorter) - 1] | ||
} | ||
|
||
shorter = input | ||
for moderation.IsInappropriate(shorter) { | ||
input = shorter | ||
shorter = shorter[1:] | ||
} | ||
|
||
if moderation.IsInappropriate(input) { | ||
fmt.Printf("Found inappropriate phrase: %s\n", input) | ||
} else { | ||
fmt.Println("No inappropriate phrase found") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
anna | ||
afk | ||
akshita | ||
asap | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.