An easy to use wrapper around the Google Perspective API
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper
src
.gitignore
LICENSE
README.md
build.gradle
gradlew
gradlew.bat
settings.gradle

README.md

perspective-api-wrapper

An easy to use wrapper around the Google Perspective API

PerspectiveAPI api = new PerspectiveAPIBuilder()
  .setApiKey("IAmAKey")
  .build();

ListenableFuture<AnalyzeCommentResponse> future = api.analyze()
  .setComment("What kind of stupid name is Guy?")
  .addContext("Hey everyone! I'm Guy, the author of this work")
  .addAttribute(Attribute.ofType(Attribute.TOXICITY))
  .postAsync();

AnalyzeCommentResponse response = future.get();

float summaryScore = response.getAttributeSummaryScore(Attribute.TOXICITY);