A Java API for checking if text contains profanity via the alt-profanity-checker Python library.

Overview

ProfanityCheckerAPI

A Java API for checking if text contains profanity via the alt-profanity-checker Python library.

It uses jep to run and interpret Python script to do this.

Requirements

  • Java 11+
  • Python 3.8+
  • jep (pip install jep)
    • Make sure your library paths are set correctly once you've installed it, as this isn't always the case, particularly on Windows.
    • If you get an "Unsatisfied Link" error, check here for solutions.
  • alt-profanity-check (pip install alt-profanity-check)

Maven

ProfanityCheckerAPI is available from Jitpack.io. You can also view the javadocs there.

Add the repository

<repositories>
   <repository>
       <id>jitpack.ioid>
       <url>https://jitpack.iourl>
   repository>
repositories>

Add the dependency

<dependency>
   <groupId>com.github.WiIIiam278groupId>
   <artifactId>ProfanityCheckerAPIartifactId>
   <version>1.1version>
   <scope>compilescope>
dependency>

Usage

Create an instance of the ProfanityChecker class to get started. It is recommended that you handle these operations on a separate thread from the main thread as jep can be an expensive blocking operation.

You can then simply get if text is profane using the #isTextProfane(String) method. Alternatively, you can return a probability double (0 to 1 inclusive) of how likely the machine learning algorithm thinks the text contains profanity using the #getTextProfanityLikelihood(String) method.

You should not make more than one instance of ProfanityChecker on the same thread, as this can result in an exception from jep. Once you are done with a ProfanityChecker, you can safely dispose of it using the #dispose method.

Javadocs for ProfanityCheckerAPI are available here.

You might also like...

Ta4j is an open source Java library for technical analysis

Ta4j is an open source Java library for technical analysis

Ta4j is an open source Java library for technical analysis. It provides the basic components for creation, evaluation and execution of trading strategies.

Dec 31, 2022

hella-html is a library that makes it hella easy to generate dynamic HTML in vanilla Java.

Hella easy HTML in Java hella-html is a library that makes it hella easy to generate dynamic HTML in vanilla Java. Very lightweight and fast, the prim

Nov 23, 2022

documents4j is a Java library for converting documents into another document format

documents4j is a Java library for converting documents into another document format. This is achieved by delegating the conversion to any

Dec 23, 2022

java common utils library

java-common-utils java common utils library 一个简单的Java通用工具类,目前的设想,包括简化异常处理工具、简易限流处理工具等 ExceptionHandler, 目标简化try catch的代码冗余度

Jan 21, 2022

High performance I/O library for Java using io_uring under the hood

nio_uring nio_uring is an I/O library for Java that uses io_uring under the hood, which aims to be: A simple and flexible API Super fast and efficient

Dec 18, 2022

archifacts is a library to extract your architectural concepts out of your application's code

archifacts is a free (Apache 2.0 license) library for describing and detecting architectural building blocks and their relationships in your Java appl

Nov 29, 2022

Tencent Kona JDK11 is a no-cost, production-ready distribution of the Open Java Development Kit (OpenJDK), Long-Term Support(LTS) with quarterly updates. Tencent Kona JDK11 is certified as compatible with the Java SE standard.

Tencent Kona JDK11 is a no-cost, production-ready distribution of the Open Java Development Kit (OpenJDK), Long-Term Support(LTS) with quarterly updates. Tencent Kona JDK11 is certified as compatible with the Java SE standard.

Tencent Kona JDK11 Tencent Kona JDK11 is a no-cost, production-ready distribution of the Open Java Development Kit (OpenJDK), Long-Term Support(LTS) w

Dec 16, 2022

Java Constraint Programming solver

https://maven-badges.herokuapp.com/maven-central/org.jacop/jacop/badge.svg [] (https://maven-badges.herokuapp.com/maven-central/org.jacop/jacop/) JaCo

Dec 30, 2022

Java Constraint Solver to solve vehicle routing, employee rostering, task assignment, conference scheduling and other planning problems.

OptaPlanner www.optaplanner.org Looking for Quickstarts? OptaPlanner’s quickstarts have moved to optaplanner-quickstarts repository. Quick development

Jan 2, 2023
Comments
  • Bump jep from 4.1.0 to 4.1.1

    Bump jep from 4.1.0 to 4.1.1

    Bumps jep from 4.1.0 to 4.1.1.

    Release notes

    Sourced from jep's releases.

    Jep 4.1.1

    What's Changed

    • The Python builtin isinstance function can be used with imported PyJClasses
    • Minor compatibility updates for older compilers.

    Full Changelog: https://github.com/ninia/jep/compare/v4.1.0...v4.1.1

    Commits
    • 056ce99 Avoid 'for' loop initial declarations for improved compatibility.
    • c744486 Add new isinstance behavior to release notes
    • 9083c70 Enable isinstance to work with PyJClass.
    • d8cd41b Improve compatibility for environments without static_assert.
    • ae003cb Start development of 4.1.1
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump annotations from 23.0.0 to 23.1.0

    Bump annotations from 23.0.0 to 23.1.0

    Bumps annotations from 23.0.0 to 23.1.0.

    Release notes

    Sourced from annotations's releases.

    23.1.0

    • Added new annotation: `@ApiStatus.Obsolete
    Changelog

    Sourced from annotations's changelog.

    Version 23.1.0

    • Added new annotation: @ApiStatus.Obsolete.
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
Releases(2.0.1)
  • 2.0.1(Dec 7, 2022)

  • 2.0(Dec 7, 2022)

    • Getting a ProfanityChecker instance is now done through the ProfanityCheckerBuilder, allowing a greater degree of flexibility
    • There is now just one isProfane method; threshold is set through the aforementioned builder
    • Changed the available normalization methods, now uses normalization type enums that provide Callable<String,String> methods for formatting text
    Source code(tar.gz)
    Source code(zip)
  • 1.3(Nov 6, 2022)

    • Added new methods to normalize strings by (by @ChromMob via #1)
    • This should make the library more versatile against the most common bypasses/workarounds for using profane language
    Source code(tar.gz)
    Source code(zip)
  • 1.2(Nov 5, 2022)

    • Migrated to gradle for building
    • Deprecated #dispose() for removal; please invoke the #close() AutoClosable method/a try-with statement to safely depose of the jep interpreter
    • Tweaked how and where jep is shaded and relocated
    • Bumped jep to 4.1.0
    Source code(tar.gz)
    Source code(zip)
  • 1.1(Feb 15, 2022)

    • Added ability to specify a jep library path in a new constructor (see jep FAQ)
    • ProfanityChecker now implements AutoClosable to facilitate usage in try-with
      • #dispose() has been deprecated, now use #close()
    • Added unit tests
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Feb 9, 2022)

Owner
William
Open source Minecraft server & software projects.
William
This repository contains Java programs to become zero to hero in Java.

This repository contains Java programs to become zero to hero in Java. Data Structure programs topic wise are also present to learn data structure problem solving in Java. Programs related to each and every concep are present from easy to intermidiate level

Sahil Batra 15 Oct 9, 2022
Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.

null 1.5k Jan 4, 2023
Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs

Diff Utils library is an OpenSource library for performing the comparison / diff operations between texts or some kind of data: computing diffs, applying patches, generating unified diffs or parsing them, generating diff output for easy future displaying (like side-by-side view) and so on.

null 951 Jan 5, 2023
BlackReflection provides a series of API to use Java Reflection easily.

BlackReflection provides a series of API to use Java Reflection easily. Developer can use annotation to assign class, field and method. Then it will generate the reflection code automatically, developer don't need to write extra code to achieve Java Reflection.

null 77 Dec 8, 2022
🌏🎮 Integrate data provided from Minecraft server with Web API.

MCWebIntegration ?? ?? Integrate data provided from Minecraft server with Web API.

yude 2 Oct 14, 2021
TheRandomAPI is an API that is responsible for generating random responses to different queries.

TheRandomAPI is an API that is responsible for generating random responses to different queries.

Elian Remaggi 1 Apr 2, 2022
A simple figura api extention that allow you to change your avatar, or upload it with script

A simple figura api extention that allow you to change your avatar, or upload it with script

null 4 Apr 14, 2022
An open-source Java library for Constraint Programming

Documentation, Support and Issues Contributing Download and installation Choco-solver is an open-source Java library for Constraint Programming. Curre

null 607 Jan 3, 2023
Java rate limiting library based on token/leaky-bucket algorithm.

Java rate-limiting library based on token-bucket algorithm. Advantages of Bucket4j Implemented on top of ideas of well known algorithm, which are by d

Vladimir Bukhtoyarov 1.7k Jan 8, 2023
A Java library for designing good error messages

JDoctor, a Java library for good error messages Designing good error messages is hard. In Java, most often, developers just rely on throwing exception

Cédric Champeau 125 Oct 24, 2022