Skip to content

Commit b352c82

Browse files
author
Ben McLean
committed
Merge branch 'master' of github.com:origma/Google-PerspectiveAPI-Java-Client
2 parents 98d5f78 + 74791b2 commit b352c82

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Google-PerspectiveAPI-Java-Client
2+
A Java client for Google's PerspectiveAPI
3+
4+
## Usage
5+
First create a new PerspectiveAPI instance:
6+
```java
7+
PerspectiveAPI pAPI = PerspectiveAPI.create(key);
8+
```
9+
Then build an analysis request using the builder:
10+
```java
11+
pAPI.analyze(new AnalyzeCommentRequest.Builder()
12+
.addRequestedAttribute(AttributeType.TOXICITY, null)
13+
.comment(new Entry.Builder()
14+
.type(ContentType.PLAIN_TEXT)
15+
.text(comment)
16+
.build())
17+
.build());
18+
```
19+
or do a simple request
20+
```java
21+
pAPI.analyze(comment);
22+
```
23+
24+
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
25+
26+
## Maven
27+
```
28+
<dependency>
29+
<groupId>com.github.origma</groupId>
30+
<artifactId>Google-PerspectiveAPI-Java-Client</artifactId>
31+
<version>0.0.3</version>
32+
</dependency>
33+
```
34+
...
35+
```
36+
<repositories>
37+
<repository>
38+
<id>jitpack.io</id>
39+
<url>https://jitpack.io</url>
40+
</repository>
41+
</repositories>
42+
```

0 commit comments

Comments
 (0)