File tree Expand file tree Collapse file tree
src/au/com/origma/perspectiveapi/v1alpha1 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99import au .com .origma .perspectiveapi .v1alpha1 .models .AnalyzeCommentRequest ;
1010import au .com .origma .perspectiveapi .v1alpha1 .models .AnalyzeCommentResponse ;
1111
12+ /**
13+ * Interact with Google's PerspectiveAPI to analyze comments and content.<br>
14+ * See the API documentation
15+ * <a href="https://github.com/conversationai/perspectiveapi/blob/master/2-api/README.md">here</a>
16+ *
17+ * @author Ben McLean <ben@origma.com.au>
18+ */
1219public interface PerspectiveAPI {
1320
21+ /**
22+ * The endpoint to which analysis requests are sent
23+ */
1424 public static final String ANALYZE_ENDPOINT = "https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze" ;
1525
26+ /**
27+ * Analyze a comment
28+ * @param request The request
29+ * @return The analysis of the request
30+ */
1631 public AnalyzeCommentResponse analyze (AnalyzeCommentRequest request );
32+
33+ /**
34+ * Analyze a comment with the default settings
35+ * @param comment The comment to analyze
36+ * @return The analysis of the request
37+ */
1738 public AnalyzeCommentResponse analyze (String comment );
1839
40+ /**
41+ * Instantiate the default implementation of the PerspectiveAPI
42+ * @param apiKey The Google API key
43+ * @return The default implementation of the PerspectiveAPI
44+ */
1945 public static PerspectiveAPI create (String apiKey ) {
2046 return new UnirestPerspectiveAPI (apiKey );
2147 }
Original file line number Diff line number Diff line change 1414import kong .unirest .HttpResponse ;
1515import kong .unirest .Unirest ;
1616
17+ /**
18+ * The default implementation of the PerspectiveAPI client, made using the Unirest library
19+ *
20+ * @author Ben McLean <ben@origma.com.au>
21+ */
1722public class UnirestPerspectiveAPI implements PerspectiveAPI {
1823
1924 String apiKey ;
Original file line number Diff line number Diff line change 1313
1414/**
1515 * A request to analyze a string of text for attributes
16- * @author Ben McLean > ben@origma.com.au < ;
16+ * @author Ben McLean < ben@origma.com.au> ;
1717 */
1818public class AnalyzeCommentRequest {
1919
@@ -93,7 +93,7 @@ public Double getSuggestCommentScore() {
9393 /**
9494 * Builds an AnalyzeCommentRequest
9595 *
96- * @author Ben McLean > ben@origma.com.au < ;
96+ * @author Ben McLean < ben@origma.com.au> ;
9797 *
9898 */
9999 public static class Builder {
@@ -213,7 +213,7 @@ public Builder suggestCommentScore(Double suggestCommentScore) {
213213
214214 /**
215215 * Build and create a new instance of AnalyzeCommentRequest
216- * @return
216+ * @return The builder
217217 */
218218 public AnalyzeCommentRequest build () {
219219 return new AnalyzeCommentRequest (this );
You can’t perform that action at this time.
0 commit comments