Skip to content

origma/Google-PerspectiveAPI-Java-Client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google-PerspectiveAPI-Java-Client

A Java client for Google's PerspectiveAPI

Usage

First create a new PerspectiveAPI instance:

PerspectiveAPI pAPI = PerspectiveAPI.create(key);

Then build an analysis request using the builder:

pAPI.analyze(new AnalyzeCommentRequest.Builder()
		.addRequestedAttribute(AttributeType.TOXICITY, null)
		.comment(new Entry.Builder()
				.type(ContentType.PLAIN_TEXT)
				.text(comment)
				.build())
		.build());

or do a simple request

pAPI.analyze(comment);

To understand the models and their functions, see https://github.com/conversationai/perspectiveapi/blob/master/2-api/models.md and https://github.com/conversationai/perspectiveapi/blob/master/2-api/methods.md

Maven

<dependency>
  <groupId>com.github.origma</groupId>
  <artifactId>Google-PerspectiveAPI-Java-Client</artifactId>
  <version>0.0.5</version>
</dependency>

...

<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>

See Also

About

A Java client for Google's PerspectiveAPI

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages