blob: 4093e26402bb7bd7aa80477647a40ba32d5697db [file] [log] [blame]
Bu Sun Kim715bd7f2019-06-14 16:50:42 -07001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="commentanalyzer_v1alpha1.html">Perspective Comment Analyzer API</a> . <a href="commentanalyzer_v1alpha1.comments.html">comments</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="#analyze">analyze(body, x__xgafv=None)</a></code></p>
79<p class="firstline">Analyzes the provided text and returns scores for requested attributes.</p>
80<p class="toc_element">
81 <code><a href="#suggestscore">suggestscore(body, x__xgafv=None)</a></code></p>
82<p class="firstline">Suggest comment scores as training data.</p>
83<h3>Method Details</h3>
84<div class="method">
85 <code class="details" id="analyze">analyze(body, x__xgafv=None)</code>
86 <pre>Analyzes the provided text and returns scores for requested attributes.
87
88Args:
89 body: object, The request body. (required)
90 The object takes the form of:
91
92{ # The comment analysis request message.
93 "comment": { # Represents a body of text. # The comment to analyze.
94 "text": "A String", # UTF-8 encoded text.
95 "type": "A String", # Type of the text field.
96 },
97 "doNotStore": True or False, # Do not store the comment or context sent in this request. By default, the
98 # service may store comments/context for debugging purposes.
99 "languages": [ # The language(s) of the comment and context (if none are specified, the
100 # language is automatically detected). If multiple languages are specified,
101 # the text is checked in all of them that are supported. Both ISO and BCP-47
102 # language codes are accepted.
103 # Current Language Restrictions:
104 # * Only English text ("en") is supported.
105 # If none of the languages specified by the caller are supported, an
106 # `UNIMPLEMENTED` error is returned.
107 "A String",
108 ],
109 "sessionId": "A String", # Session ID. Used to join related RPCs into a single session. For example,
110 # an interactive tool that calls both the AnalyzeComment and
111 # SuggestCommentScore RPCs should set all invocations of both RPCs to the
112 # same Session ID, typically a random 64-bit integer.
113 "context": { # Context is typically something that a Comment is referencing or replying to # The context of the comment.
114 # (such as an article, or previous comment).
115 # Note: Populate only ONE OF the following fields. The oneof syntax cannot be
116 # used because that would require nesting entries inside another message and
117 # breaking backwards compatibility. The server will return an error if more
118 # than one of the following fields is present.
119 "articleAndParentComment": { # A type of context specific to a comment left on a single-threaded comment # Information about the source for which the original comment was made, and
120 # any parent comment info.
121 # message board, where comments are either a top level comment or the child of
122 # a top level comment.
123 "article": { # Represents a body of text. # The source content about which the comment was made (article text, article
124 # summary, video transcript, etc).
125 "text": "A String", # UTF-8 encoded text.
126 "type": "A String", # Type of the text field.
127 },
128 "parentComment": { # Represents a body of text. # Refers to text that is a direct parent of the source comment, such as in a
129 # one-deep threaded message board. This field will only be present for
130 # comments that are replies to other comments and will not be populated for
131 # direct comments on the article_text.
132 "text": "A String", # UTF-8 encoded text.
133 "type": "A String", # Type of the text field.
134 },
135 },
136 "entries": [ # A list of messages. For example, a linear comments section or forum thread.
137 { # Represents a body of text.
138 "text": "A String", # UTF-8 encoded text.
139 "type": "A String", # Type of the text field.
140 },
141 ],
142 },
143 "clientToken": "A String", # Opaque token that is echoed from the request to the response.
144 "requestedAttributes": { # Specification of requested attributes. The AttributeParameters serve as
145 # configuration for each associated attribute. The map keys are attribute
146 # names. The following attributes are available:
147 # "ATTACK_ON_AUTHOR" - Attack on author of original article or post.
148 # "ATTACK_ON_COMMENTER" - Attack on fellow commenter.
149 # "ATTACK_ON_PUBLISHER" - Attack on publisher of article/post.
150 # "INCOHERENT" - Difficult to understand, nonsensical.
151 # "INFLAMMATORY" - Intending to provoke or inflame.
152 # "OBSCENE" - Obscene, such as cursing.
153 # "OFF_TOPIC" - Not related to the original topic.
154 # "SPAM" - Commercial/advertising spam content.
155 # "UNSUBSTANTIAL" - Trivial.
156 "a_key": { # Configurable parameters for attribute scoring.
157 "scoreThreshold": 3.14, # Don't return scores for this attribute that are below this threshold. If
158 # unset, a default threshold will be applied. A FloatValue wrapper is used to
159 # distinguish between 0 vs. default/unset.
160 "scoreType": "A String", # What type of scores to return. If unset, defaults to probability scores.
161 },
162 },
163 "spanAnnotations": True or False, # An advisory parameter that will return span annotations if the model
164 # is capable of providing scores with sub-comment resolution. This will
165 # likely increase the size of the returned message.
166 "communityId": "A String", # Optional identifier associating this AnalyzeCommentRequest with a
167 # particular client's community. Different communities may have different
168 # norms and rules. Specifying this value enables us to explore building
169 # community-specific models for clients.
170 }
171
172 x__xgafv: string, V1 error format.
173 Allowed values
174 1 - v1 error format
175 2 - v2 error format
176
177Returns:
178 An object of the form:
179
180 { # The comment analysis response message.
181 "languages": [ # The language(s) used by CommentAnalyzer service to choose which Model to
182 # use when analyzing the comment. Might better be called
183 # "effective_languages". The logic used to make the choice is as follows:
184 # if Request.languages.empty()
185 # effective_languages = detected_languages
186 # else
187 # effective_languages = Request.languages
188 "A String",
189 ],
190 "detectedLanguages": [ # Contains the languages detected from the text content, sorted in order of
191 # likelihood.
192 "A String",
193 ],
194 "attributeScores": { # Scores for the requested attributes. The map keys are attribute names (same
195 # as the requested_attribute field in AnalyzeCommentRequest, for example
196 # "ATTACK_ON_AUTHOR", "INFLAMMATORY", etc).
197 "a_key": { # This holds score values for a single attribute. It contains both per-span
198 # scores as well as an overall summary score..
199 "summaryScore": { # Analysis scores are described by a value and a ScoreType. # Overall score for comment as a whole.
200 "type": "A String", # The type of the above value.
201 "value": 3.14, # Score value. Semantics described by type below.
202 },
203 "spanScores": [ # Per-span scores.
204 { # This is a single score for a given span of text.
205 "begin": 42, # "begin" and "end" describe the span of the original text that the attribute
206 # score applies to. The values are the UTF-16 codepoint range. "end" is
207 # exclusive. For example, with the text "Hi there", the begin/end pair (0,2)
208 # describes the text "Hi".
209 #
210 # If "begin" and "end" are unset, the score applies to the full text.
211 "score": { # Analysis scores are described by a value and a ScoreType. # The score value.
212 "type": "A String", # The type of the above value.
213 "value": 3.14, # Score value. Semantics described by type below.
214 },
215 "end": 42,
216 },
217 ],
218 },
219 },
220 "clientToken": "A String", # Same token from the original AnalyzeCommentRequest.
221 }</pre>
222</div>
223
224<div class="method">
225 <code class="details" id="suggestscore">suggestscore(body, x__xgafv=None)</code>
226 <pre>Suggest comment scores as training data.
227
228Args:
229 body: object, The request body. (required)
230 The object takes the form of:
231
232{ # The comment score suggestion request message.
233 "comment": { # Represents a body of text. # The comment being scored.
234 "text": "A String", # UTF-8 encoded text.
235 "type": "A String", # Type of the text field.
236 },
237 "languages": [ # The language(s) of the comment and context (if none are specified, the
238 # language is automatically detected). If multiple languages are specified,
239 # the text is checked in all of them that are supported. Both ISO and BCP-47
240 # language codes are accepted.
241 # Current Language Restrictions:
242 # * Only English text ("en") is supported.
243 # If none of the languages specified by the caller are supported, an
244 # `UNIMPLEMENTED` error is returned.
245 "A String",
246 ],
247 "sessionId": "A String", # Session ID. Used to join related RPCs into a single session. For example,
248 # an interactive tool that calls both the AnalyzeComment and
249 # SuggestCommentScore RPCs should set all invocations of both RPCs to the
250 # same Session ID, typically a random 64-bit integer.
251 "context": { # Context is typically something that a Comment is referencing or replying to # The context of the comment.
252 # (such as an article, or previous comment).
253 # Note: Populate only ONE OF the following fields. The oneof syntax cannot be
254 # used because that would require nesting entries inside another message and
255 # breaking backwards compatibility. The server will return an error if more
256 # than one of the following fields is present.
257 "articleAndParentComment": { # A type of context specific to a comment left on a single-threaded comment # Information about the source for which the original comment was made, and
258 # any parent comment info.
259 # message board, where comments are either a top level comment or the child of
260 # a top level comment.
261 "article": { # Represents a body of text. # The source content about which the comment was made (article text, article
262 # summary, video transcript, etc).
263 "text": "A String", # UTF-8 encoded text.
264 "type": "A String", # Type of the text field.
265 },
266 "parentComment": { # Represents a body of text. # Refers to text that is a direct parent of the source comment, such as in a
267 # one-deep threaded message board. This field will only be present for
268 # comments that are replies to other comments and will not be populated for
269 # direct comments on the article_text.
270 "text": "A String", # UTF-8 encoded text.
271 "type": "A String", # Type of the text field.
272 },
273 },
274 "entries": [ # A list of messages. For example, a linear comments section or forum thread.
275 { # Represents a body of text.
276 "text": "A String", # UTF-8 encoded text.
277 "type": "A String", # Type of the text field.
278 },
279 ],
280 },
281 "clientToken": "A String", # Opaque token that is echoed from the request to the response.
282 "communityId": "A String", # Optional identifier associating this comment score suggestion with a
283 # particular sub-community. Different communities may have different norms
284 # and rules. Specifying this value enables training community-specific
285 # models.
286 "attributeScores": { # Attribute scores for the comment. The map keys are attribute names, same as
287 # the requested_attribute field in AnalyzeCommentRequest (for example
288 # "ATTACK_ON_AUTHOR", "INFLAMMATORY", etc.). This field has the same type as
289 # the `attribute_scores` field in AnalyzeCommentResponse.
290 #
291 # To specify an overall attribute score for the entire comment as a whole,
292 # use the `summary_score` field of the mapped AttributeScores object. To
293 # specify scores on specific subparts of the comment, use the `span_scores`
294 # field. All SpanScore objects must have begin and end fields set.
295 #
296 # All Score objects must be explicitly set (for binary classification, use
297 # the score values 0 and 1). If Score objects don't include a ScoreType,
298 # `PROBABILITY` is assumed.
299 #
300 # `attribute_scores` must not be empty. The mapped AttributeScores objects
301 # also must not be empty. An `INVALID_ARGUMENT` error is returned for all
302 # malformed requests.
303 "a_key": { # This holds score values for a single attribute. It contains both per-span
304 # scores as well as an overall summary score..
305 "summaryScore": { # Analysis scores are described by a value and a ScoreType. # Overall score for comment as a whole.
306 "type": "A String", # The type of the above value.
307 "value": 3.14, # Score value. Semantics described by type below.
308 },
309 "spanScores": [ # Per-span scores.
310 { # This is a single score for a given span of text.
311 "begin": 42, # "begin" and "end" describe the span of the original text that the attribute
312 # score applies to. The values are the UTF-16 codepoint range. "end" is
313 # exclusive. For example, with the text "Hi there", the begin/end pair (0,2)
314 # describes the text "Hi".
315 #
316 # If "begin" and "end" are unset, the score applies to the full text.
317 "score": { # Analysis scores are described by a value and a ScoreType. # The score value.
318 "type": "A String", # The type of the above value.
319 "value": 3.14, # Score value. Semantics described by type below.
320 },
321 "end": 42,
322 },
323 ],
324 },
325 },
326 }
327
328 x__xgafv: string, V1 error format.
329 Allowed values
330 1 - v1 error format
331 2 - v2 error format
332
333Returns:
334 An object of the form:
335
336 { # The comment score suggestion response message.
337 "requestedLanguages": [ # The list of languages provided in the request.
338 "A String",
339 ],
340 "detectedLanguages": [ # The list of languages detected from the comment text.
341 "A String",
342 ],
343 "clientToken": "A String", # Same token from the original SuggestCommentScoreRequest.
344 }</pre>
345</div>
346
347</body></html>