-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathcommentanalyzer-api.json
459 lines (459 loc) · 19.6 KB
/
commentanalyzer-api.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
{
"auth": {
"oauth2": {
"scopes": {
"https://www.googleapis.com/auth/userinfo.email": {
"description": "View your email address"
}
}
}
},
"basePath": "",
"baseUrl": "https://commentanalyzer.googleapis.com/",
"batchPath": "batch",
"canonicalName": "Comment Analyzer",
"description": "The Perspective Comment Analyzer API provides information about the potential impact of a comment on a conversation (e.g. it can provide a score for the \"toxicity\" of a comment). Users can leverage the \"SuggestCommentScore\" method to submit corrections to improve Perspective over time. Users can set the \"doNotStore\" flag to ensure that all submitted comments are automatically deleted after scores are returned.",
"discoveryVersion": "v1",
"documentationLink": "https://github.com/conversationai/perspectiveapi/blob/master/README.md",
"icons": {
"x16": "http://www.google.com/images/icons/product/search-16.gif",
"x32": "http://www.google.com/images/icons/product/search-32.gif"
},
"id": "commentanalyzer:v1alpha1",
"kind": "discovery#restDescription",
"mtlsRootUrl": "https://commentanalyzer.mtls.googleapis.com/",
"name": "commentanalyzer",
"ownerDomain": "google.com",
"ownerName": "Google",
"parameters": {
"$.xgafv": {
"description": "V1 error format.",
"enum": [
"1",
"2"
],
"enumDescriptions": [
"v1 error format",
"v2 error format"
],
"location": "query",
"type": "string"
},
"access_token": {
"description": "OAuth access token.",
"location": "query",
"type": "string"
},
"alt": {
"default": "json",
"description": "Data format for response.",
"enum": [
"json",
"media",
"proto"
],
"enumDescriptions": [
"Responses with Content-Type of application/json",
"Media download with context-dependent Content-Type",
"Responses with Content-Type of application/x-protobuf"
],
"location": "query",
"type": "string"
},
"callback": {
"description": "JSONP",
"location": "query",
"type": "string"
},
"fields": {
"description": "Selector specifying which fields to include in a partial response.",
"location": "query",
"type": "string"
},
"key": {
"description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
"location": "query",
"type": "string"
},
"oauth_token": {
"description": "OAuth 2.0 token for the current user.",
"location": "query",
"type": "string"
},
"prettyPrint": {
"default": "true",
"description": "Returns response with indentations and line breaks.",
"location": "query",
"type": "boolean"
},
"quotaUser": {
"description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.",
"location": "query",
"type": "string"
},
"uploadType": {
"description": "Legacy upload protocol for media (e.g. \"media\", \"multipart\").",
"location": "query",
"type": "string"
},
"upload_protocol": {
"description": "Upload protocol for media (e.g. \"raw\", \"multipart\").",
"location": "query",
"type": "string"
}
},
"protocol": "rest",
"resources": {
"comments": {
"methods": {
"analyze": {
"description": "Analyzes the provided text and returns scores for requested attributes.",
"flatPath": "v1alpha1/comments:analyze",
"httpMethod": "POST",
"id": "commentanalyzer.comments.analyze",
"parameterOrder": [],
"parameters": {},
"path": "v1alpha1/comments:analyze",
"request": {
"$ref": "AnalyzeCommentRequest"
},
"response": {
"$ref": "AnalyzeCommentResponse"
},
"scopes": [
"https://www.googleapis.com/auth/userinfo.email"
]
},
"suggestscore": {
"description": "Suggest comment scores as training data.",
"flatPath": "v1alpha1/comments:suggestscore",
"httpMethod": "POST",
"id": "commentanalyzer.comments.suggestscore",
"parameterOrder": [],
"parameters": {},
"path": "v1alpha1/comments:suggestscore",
"request": {
"$ref": "SuggestCommentScoreRequest"
},
"response": {
"$ref": "SuggestCommentScoreResponse"
},
"scopes": [
"https://www.googleapis.com/auth/userinfo.email"
]
}
}
}
},
"revision": "20200301",
"rootUrl": "https://commentanalyzer.googleapis.com/",
"schemas": {
"AnalyzeCommentRequest": {
"description": "The comment analysis request message.\nLINT.IfChange",
"id": "AnalyzeCommentRequest",
"properties": {
"clientToken": {
"description": "Opaque token that is echoed from the request to the response.",
"type": "string"
},
"comment": {
"$ref": "TextEntry",
"description": "The comment to analyze."
},
"communityId": {
"description": "Optional identifier associating this AnalyzeCommentRequest with a\nparticular client's community. Different communities may have different\nnorms and rules. Specifying this value enables us to explore building\ncommunity-specific models for clients.",
"type": "string"
},
"context": {
"$ref": "Context",
"description": "The context of the comment."
},
"doNotStore": {
"description": "Do not store the comment or context sent in this request. By default, the\nservice may store comments/context for debugging purposes.",
"type": "boolean"
},
"languages": {
"description": "The language(s) of the comment and context. If none are specified, we\nattempt to automatically detect the language. Specifying multiple languages\nmeans the text contains multiple lanugages. Both ISO and BCP-47 language\ncodes are accepted.\n\nThe server returns an error if no language was specified and language\ndetection fails. The server also returns an error if the languages (either\nspecified by the caller, or auto-detected) are not *all* supported by the\nservice.",
"items": {
"type": "string"
},
"type": "array"
},
"requestedAttributes": {
"additionalProperties": {
"$ref": "AttributeParameters"
},
"description": "Specification of requested attributes. The AttributeParameters serve as\nconfiguration for each associated attribute. The map keys are attribute\nnames. The available attributes may be different on each RFE installation,\nand can be seen by calling ListAttributes (see above).\nFor the prod installation, known as Perspective API, at\nblade:commentanalyzer-esf and commentanalyzer.googleapis.com, see\ngo/checker-models (internal) and\nhttps://github.com/conversationai/perspectiveapi/blob/master/2-api/models.md#all-attribute-types.",
"type": "object"
},
"sessionId": {
"description": "Session ID. Used to join related RPCs into a single session. For example,\nan interactive tool that calls both the AnalyzeComment and\nSuggestCommentScore RPCs should set all invocations of both RPCs to the\nsame Session ID, typically a random 64-bit integer.",
"type": "string"
},
"spanAnnotations": {
"description": "An advisory parameter that will return span annotations if the model\nis capable of providing scores with sub-comment resolution. This will\nlikely increase the size of the returned message.",
"type": "boolean"
}
},
"type": "object"
},
"AnalyzeCommentResponse": {
"description": "The comment analysis response message.",
"id": "AnalyzeCommentResponse",
"properties": {
"attributeScores": {
"additionalProperties": {
"$ref": "AttributeScores"
},
"description": "Scores for the requested attributes. The map keys are attribute names (same\nas the requested_attribute field in AnalyzeCommentRequest, for example\n\"ATTACK_ON_AUTHOR\", \"INFLAMMATORY\", etc).",
"type": "object"
},
"clientToken": {
"description": "Same token from the original AnalyzeCommentRequest.",
"type": "string"
},
"detectedLanguages": {
"description": "Contains the languages detected from the text content, sorted in order of\nlikelihood.",
"items": {
"type": "string"
},
"type": "array"
},
"languages": {
"description": "The language(s) used by CommentAnalyzer service to choose which Model to\nuse when analyzing the comment. Might better be called\n\"effective_languages\". The logic used to make the choice is as follows:\n if !Request.languages.empty()\n effective_languages = Request.languages\n else\n effective_languages = detected_languages[0]",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"ArticleAndParentComment": {
"description": "A type of context specific to a comment left on a single-threaded comment\nmessage board, where comments are either a top level comment or the child of\na top level comment.",
"id": "ArticleAndParentComment",
"properties": {
"article": {
"$ref": "TextEntry",
"description": "The source content about which the comment was made (article text, article\nsummary, video transcript, etc)."
},
"parentComment": {
"$ref": "TextEntry",
"description": "Refers to text that is a direct parent of the source comment, such as in a\none-deep threaded message board. This field will only be present for\ncomments that are replies to other comments and will not be populated for\ndirect comments on the article_text."
}
},
"type": "object"
},
"AttributeParameters": {
"description": "Configurable parameters for attribute scoring.",
"id": "AttributeParameters",
"properties": {
"scoreThreshold": {
"description": "Don't return scores for this attribute that are below this threshold. If\nunset, a default threshold will be applied. A FloatValue wrapper is used to\ndistinguish between 0 vs. default/unset.",
"format": "float",
"type": "number"
},
"scoreType": {
"description": "What type of scores to return. If unset, defaults to probability scores.",
"enum": [
"SCORE_TYPE_UNSPECIFIED",
"PROBABILITY",
"STD_DEV_SCORE",
"PERCENTILE",
"RAW"
],
"enumDescriptions": [
"Unspecified. Defaults to PROBABILITY scores if available, and otherwise\nRAW. Every model has a RAW score.",
"Probability scores are in the range [0, 1] and indicate level of confidence\nin the attribute label.",
"Standard deviation scores are in the range (-inf, +inf).",
"Percentile scores are in the range [0, 1] and indicate the percentile of\nthe raw score, normalized with a test dataset. This is not generally\nrecommended, as the normalization is dependent on the dataset used, which\nmay not match other usecases.",
"Raw scores are the raw values from the model, and may take any value. This\nis primarily for debugging/testing, and not generally recommended."
],
"type": "string"
}
},
"type": "object"
},
"AttributeScores": {
"description": "This holds score values for a single attribute. It contains both per-span\nscores as well as an overall summary score..",
"id": "AttributeScores",
"properties": {
"spanScores": {
"description": "Per-span scores.",
"items": {
"$ref": "SpanScore"
},
"type": "array"
},
"summaryScore": {
"$ref": "Score",
"description": "Overall score for comment as a whole."
}
},
"type": "object"
},
"Context": {
"description": "Context is typically something that a Comment is referencing or replying to\n(such as an article, or previous comment).\nNote: Populate only ONE OF the following fields. The oneof syntax cannot be\nused because that would require nesting entries inside another message and\nbreaking backwards compatibility. The server will return an error if more\nthan one of the following fields is present.",
"id": "Context",
"properties": {
"articleAndParentComment": {
"$ref": "ArticleAndParentComment",
"description": "Information about the source for which the original comment was made, and\nany parent comment info."
},
"entries": {
"description": "A list of messages. For example, a linear comments section or forum thread.",
"items": {
"$ref": "TextEntry"
},
"type": "array"
}
},
"type": "object"
},
"Score": {
"description": "Analysis scores are described by a value and a ScoreType.",
"id": "Score",
"properties": {
"type": {
"description": "The type of the above value.",
"enum": [
"SCORE_TYPE_UNSPECIFIED",
"PROBABILITY",
"STD_DEV_SCORE",
"PERCENTILE",
"RAW"
],
"enumDescriptions": [
"Unspecified. Defaults to PROBABILITY scores if available, and otherwise\nRAW. Every model has a RAW score.",
"Probability scores are in the range [0, 1] and indicate level of confidence\nin the attribute label.",
"Standard deviation scores are in the range (-inf, +inf).",
"Percentile scores are in the range [0, 1] and indicate the percentile of\nthe raw score, normalized with a test dataset. This is not generally\nrecommended, as the normalization is dependent on the dataset used, which\nmay not match other usecases.",
"Raw scores are the raw values from the model, and may take any value. This\nis primarily for debugging/testing, and not generally recommended."
],
"type": "string"
},
"value": {
"description": "Score value. Semantics described by type below.",
"format": "float",
"type": "number"
}
},
"type": "object"
},
"SpanScore": {
"description": "This is a single score for a given span of text.",
"id": "SpanScore",
"properties": {
"begin": {
"description": "\"begin\" and \"end\" describe the span of the original text that the attribute\nscore applies to. The values are the UTF-16 codepoint range. \"end\" is\nexclusive. For example, with the text \"Hi there\", the begin/end pair (0,2)\ndescribes the text \"Hi\".\n\nIf \"begin\" and \"end\" are unset, the score applies to the full text.",
"format": "int32",
"type": "integer"
},
"end": {
"format": "int32",
"type": "integer"
},
"score": {
"$ref": "Score",
"description": "The score value."
}
},
"type": "object"
},
"SuggestCommentScoreRequest": {
"description": "The comment score suggestion request message.",
"id": "SuggestCommentScoreRequest",
"properties": {
"attributeScores": {
"additionalProperties": {
"$ref": "AttributeScores"
},
"description": "Attribute scores for the comment. The map keys are attribute names, same as\nthe requested_attribute field in AnalyzeCommentRequest (for example\n\"ATTACK_ON_AUTHOR\", \"INFLAMMATORY\", etc.). This field has the same type as\nthe `attribute_scores` field in AnalyzeCommentResponse.\n\nTo specify an overall attribute score for the entire comment as a whole,\nuse the `summary_score` field of the mapped AttributeScores object. To\nspecify scores on specific subparts of the comment, use the `span_scores`\nfield. All SpanScore objects must have begin and end fields set.\n\nAll Score objects must be explicitly set (for binary classification, use\nthe score values 0 and 1). If Score objects don't include a ScoreType,\n`PROBABILITY` is assumed.\n\n`attribute_scores` must not be empty. The mapped AttributeScores objects\nalso must not be empty. An `INVALID_ARGUMENT` error is returned for all\nmalformed requests.",
"type": "object"
},
"clientToken": {
"description": "Opaque token that is echoed from the request to the response.",
"type": "string"
},
"comment": {
"$ref": "TextEntry",
"description": "The comment being scored."
},
"communityId": {
"description": "Optional identifier associating this comment score suggestion with a\nparticular sub-community. Different communities may have different norms\nand rules. Specifying this value enables training community-specific\nmodels.",
"type": "string"
},
"context": {
"$ref": "Context",
"description": "The context of the comment."
},
"languages": {
"description": "The language(s) of the comment and context. If none are specified, we\nattempt to automatically detect the language. Both ISO and BCP-47 language\ncodes are accepted.",
"items": {
"type": "string"
},
"type": "array"
},
"sessionId": {
"description": "Session ID. Used to join related RPCs into a single session. For example,\nan interactive tool that calls both the AnalyzeComment and\nSuggestCommentScore RPCs should set all invocations of both RPCs to the\nsame Session ID, typically a random 64-bit integer.",
"type": "string"
}
},
"type": "object"
},
"SuggestCommentScoreResponse": {
"description": "The comment score suggestion response message.",
"id": "SuggestCommentScoreResponse",
"properties": {
"clientToken": {
"description": "Same token from the original SuggestCommentScoreRequest.",
"type": "string"
},
"detectedLanguages": {
"description": "The list of languages detected from the comment text.",
"items": {
"type": "string"
},
"type": "array"
},
"requestedLanguages": {
"description": "The list of languages provided in the request.",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
},
"TextEntry": {
"description": "Represents a body of text.",
"id": "TextEntry",
"properties": {
"text": {
"description": "UTF-8 encoded text.",
"type": "string"
},
"type": {
"description": "Type of the text field.",
"enum": [
"TEXT_TYPE_UNSPECIFIED",
"PLAIN_TEXT",
"HTML"
],
"enumDescriptions": [
"The content type is not specified. Text will be interpreted as plain text\nby default.",
"Plain text.",
"HTML."
],
"type": "string"
}
},
"type": "object"
}
},
"servicePath": "",
"title": "Perspective Comment Analyzer API",
"version": "v1alpha1",
"version_module": true
}