...

Package commentanalyzer

import "google.golang.org/api/commentanalyzer/v1alpha1"
Overview
Index

Overview ▾

Package commentanalyzer provides access to the Perspective Comment Analyzer API.

For product documentation, see: https://github.com/conversationai/perspectiveapi/blob/master/README.md

Creating a client

Usage example:

import "google.golang.org/api/commentanalyzer/v1alpha1"
...
ctx := context.Background()
commentanalyzerService, err := commentanalyzer.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication.

For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:

commentanalyzerService, err := commentanalyzer.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:

config := &oauth2.Config{...}
// ...
token, err := config.Exchange(ctx, ...)
commentanalyzerService, err := commentanalyzer.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See https://godoc.org/google.golang.org/api/option/ for details on options.

Index ▾

Constants
type AnalyzeCommentRequest
    func (s *AnalyzeCommentRequest) MarshalJSON() ([]byte, error)
type AnalyzeCommentResponse
    func (s *AnalyzeCommentResponse) MarshalJSON() ([]byte, error)
type ArticleAndParentComment
    func (s *ArticleAndParentComment) MarshalJSON() ([]byte, error)
type AttributeParameters
    func (s *AttributeParameters) MarshalJSON() ([]byte, error)
    func (s *AttributeParameters) UnmarshalJSON(data []byte) error
type AttributeScores
    func (s *AttributeScores) MarshalJSON() ([]byte, error)
type CommentsAnalyzeCall
    func (c *CommentsAnalyzeCall) Context(ctx context.Context) *CommentsAnalyzeCall
    func (c *CommentsAnalyzeCall) Do(opts ...googleapi.CallOption) (*AnalyzeCommentResponse, error)
    func (c *CommentsAnalyzeCall) Fields(s ...googleapi.Field) *CommentsAnalyzeCall
    func (c *CommentsAnalyzeCall) Header() http.Header
type CommentsService
    func NewCommentsService(s *Service) *CommentsService
    func (r *CommentsService) Analyze(analyzecommentrequest *AnalyzeCommentRequest) *CommentsAnalyzeCall
    func (r *CommentsService) Suggestscore(suggestcommentscorerequest *SuggestCommentScoreRequest) *CommentsSuggestscoreCall
type CommentsSuggestscoreCall
    func (c *CommentsSuggestscoreCall) Context(ctx context.Context) *CommentsSuggestscoreCall
    func (c *CommentsSuggestscoreCall) Do(opts ...googleapi.CallOption) (*SuggestCommentScoreResponse, error)
    func (c *CommentsSuggestscoreCall) Fields(s ...googleapi.Field) *CommentsSuggestscoreCall
    func (c *CommentsSuggestscoreCall) Header() http.Header
type Context
    func (s *Context) MarshalJSON() ([]byte, error)
type Score
    func (s *Score) MarshalJSON() ([]byte, error)
    func (s *Score) UnmarshalJSON(data []byte) error
type Service
    func New(client *http.Client) (*Service, error)
    func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)
type SpanScore
    func (s *SpanScore) MarshalJSON() ([]byte, error)
type SuggestCommentScoreRequest
    func (s *SuggestCommentScoreRequest) MarshalJSON() ([]byte, error)
type SuggestCommentScoreResponse
    func (s *SuggestCommentScoreResponse) MarshalJSON() ([]byte, error)
type TextEntry
    func (s *TextEntry) MarshalJSON() ([]byte, error)

Package files

commentanalyzer-gen.go

Constants

OAuth2 scopes used by this API.

const (
    // View your email address
    UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.email"
)

type AnalyzeCommentRequest

AnalyzeCommentRequest: The comment analysis request message. LINT.IfChange

type AnalyzeCommentRequest struct {
    // ClientToken: Opaque token that is echoed from the request to the
    // response.
    ClientToken string `json:"clientToken,omitempty"`

    // Comment: The comment to analyze.
    Comment *TextEntry `json:"comment,omitempty"`

    // CommunityId: Optional identifier associating this
    // AnalyzeCommentRequest with a
    // particular client's community. Different communities may have
    // different
    // norms and rules. Specifying this value enables us to explore
    // building
    // community-specific models for clients.
    CommunityId string `json:"communityId,omitempty"`

    // Context: The context of the comment.
    Context *Context `json:"context,omitempty"`

    // DoNotStore: Do not store the comment or context sent in this request.
    // By default, the
    // service may store comments/context for debugging purposes.
    DoNotStore bool `json:"doNotStore,omitempty"`

    // Languages: The language(s) of the comment and context. If none are
    // specified, we
    // attempt to automatically detect the language. Specifying multiple
    // languages
    // means the text contains multiple lanugages. Both ISO and BCP-47
    // language
    // codes are accepted.
    //
    // The server returns an error if no language was specified and
    // language
    // detection fails. The server also returns an error if the languages
    // (either
    // specified by the caller, or auto-detected) are not *all* supported by
    // the
    // service.
    Languages []string `json:"languages,omitempty"`

    // RequestedAttributes: Specification of requested attributes. The
    // AttributeParameters serve as
    // configuration for each associated attribute. The map keys are
    // attribute
    // names. The available attributes may be different on each RFE
    // installation,
    // and can be seen by calling ListAttributes (see above).
    // For the prod installation, known as Perspective API,
    // at
    // blade:commentanalyzer-esf and commentanalyzer.googleapis.com,
    // see
    // go/checker-models (internal)
    // and
    // https://github.com/conversationai/perspectiveapi/blob/master/2-api
    // /models.md#all-attribute-types.
    RequestedAttributes map[string]AttributeParameters `json:"requestedAttributes,omitempty"`

    // SessionId: Session ID. Used to join related RPCs into a single
    // session. For example,
    // an interactive tool that calls both the AnalyzeComment
    // and
    // SuggestCommentScore RPCs should set all invocations of both RPCs to
    // the
    // same Session ID, typically a random 64-bit integer.
    SessionId string `json:"sessionId,omitempty"`

    // SpanAnnotations: An advisory parameter that will return span
    // annotations if the model
    // is capable of providing scores with sub-comment resolution. This
    // will
    // likely increase the size of the returned message.
    SpanAnnotations bool `json:"spanAnnotations,omitempty"`

    // ForceSendFields is a list of field names (e.g. "ClientToken") to
    // unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "ClientToken") to include
    // in API requests with the JSON null value. By default, fields with
    // empty values are omitted from API requests. However, any field with
    // an empty value appearing in NullFields will be sent to the server as
    // null. It is an error if a field in this list has a non-empty value.
    // This may be used to include null fields in Patch requests.
    NullFields []string `json:"-"`
}

func (*AnalyzeCommentRequest) MarshalJSON

func (s *AnalyzeCommentRequest) MarshalJSON() ([]byte, error)

type AnalyzeCommentResponse

AnalyzeCommentResponse: The comment analysis response message.

type AnalyzeCommentResponse struct {
    // AttributeScores: Scores for the requested attributes. The map keys
    // are attribute names (same
    // as the requested_attribute field in AnalyzeCommentRequest, for
    // example
    // "ATTACK_ON_AUTHOR", "INFLAMMATORY", etc).
    AttributeScores map[string]AttributeScores `json:"attributeScores,omitempty"`

    // ClientToken: Same token from the original AnalyzeCommentRequest.
    ClientToken string `json:"clientToken,omitempty"`

    // DetectedLanguages: Contains the languages detected from the text
    // content, sorted in order of
    // likelihood.
    DetectedLanguages []string `json:"detectedLanguages,omitempty"`

    // Languages: The language(s) used by CommentAnalyzer service to choose
    // which Model to
    // use when analyzing the comment. Might better be
    // called
    // "effective_languages". The logic used to make the choice is as
    // follows:
    //   if !Request.languages.empty()
    //     effective_languages = Request.languages
    //   else
    //     effective_languages = detected_languages[0]
    Languages []string `json:"languages,omitempty"`

    // ServerResponse contains the HTTP response code and headers from the
    // server.
    googleapi.ServerResponse `json:"-"`

    // ForceSendFields is a list of field names (e.g. "AttributeScores") to
    // unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "AttributeScores") to
    // include in API requests with the JSON null value. By default, fields
    // with empty values are omitted from API requests. However, any field
    // with an empty value appearing in NullFields will be sent to the
    // server as null. It is an error if a field in this list has a
    // non-empty value. This may be used to include null fields in Patch
    // requests.
    NullFields []string `json:"-"`
}

func (*AnalyzeCommentResponse) MarshalJSON

func (s *AnalyzeCommentResponse) MarshalJSON() ([]byte, error)

type ArticleAndParentComment

ArticleAndParentComment: A type of context specific to a comment left on a single-threaded comment message board, where comments are either a top level comment or the child of a top level comment.

type ArticleAndParentComment struct {
    // Article: The source content about which the comment was made (article
    // text, article
    // summary, video transcript, etc).
    Article *TextEntry `json:"article,omitempty"`

    // ParentComment: Refers to text that is a direct parent of the source
    // comment, such as in a
    // one-deep threaded message board. This field will only be present
    // for
    // comments that are replies to other comments and will not be populated
    // for
    // direct comments on the article_text.
    ParentComment *TextEntry `json:"parentComment,omitempty"`

    // ForceSendFields is a list of field names (e.g. "Article") to
    // unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "Article") to include in
    // API requests with the JSON null value. By default, fields with empty
    // values are omitted from API requests. However, any field with an
    // empty value appearing in NullFields will be sent to the server as
    // null. It is an error if a field in this list has a non-empty value.
    // This may be used to include null fields in Patch requests.
    NullFields []string `json:"-"`
}

func (*ArticleAndParentComment) MarshalJSON

func (s *ArticleAndParentComment) MarshalJSON() ([]byte, error)

type AttributeParameters

AttributeParameters: Configurable parameters for attribute scoring.

type AttributeParameters struct {
    // ScoreThreshold: Don't return scores for this attribute that are below
    // this threshold. If
    // unset, a default threshold will be applied. A FloatValue wrapper is
    // used to
    // distinguish between 0 vs. default/unset.
    ScoreThreshold float64 `json:"scoreThreshold,omitempty"`

    // ScoreType: What type of scores to return. If unset, defaults to
    // probability scores.
    //
    // Possible values:
    //   "SCORE_TYPE_UNSPECIFIED" - Unspecified. Defaults to PROBABILITY
    // scores if available, and otherwise
    // RAW. Every model has a RAW score.
    //   "PROBABILITY" - Probability scores are in the range [0, 1] and
    // indicate level of confidence
    // in the attribute label.
    //   "STD_DEV_SCORE" - Standard deviation scores are in the range (-inf,
    // +inf).
    //   "PERCENTILE" - Percentile scores are in the range [0, 1] and
    // indicate the percentile of
    // the raw score, normalized with a test dataset. This is not
    // generally
    // recommended, as the normalization is dependent on the dataset used,
    // which
    // may not match other usecases.
    //   "RAW" - Raw scores are the raw values from the model, and may take
    // any value. This
    // is primarily for debugging/testing, and not generally recommended.
    ScoreType string `json:"scoreType,omitempty"`

    // ForceSendFields is a list of field names (e.g. "ScoreThreshold") to
    // unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "ScoreThreshold") to
    // include in API requests with the JSON null value. By default, fields
    // with empty values are omitted from API requests. However, any field
    // with an empty value appearing in NullFields will be sent to the
    // server as null. It is an error if a field in this list has a
    // non-empty value. This may be used to include null fields in Patch
    // requests.
    NullFields []string `json:"-"`
}

func (*AttributeParameters) MarshalJSON

func (s *AttributeParameters) MarshalJSON() ([]byte, error)

func (*AttributeParameters) UnmarshalJSON

func (s *AttributeParameters) UnmarshalJSON(data []byte) error

type AttributeScores

AttributeScores: This holds score values for a single attribute. It contains both per-span scores as well as an overall summary score..

type AttributeScores struct {
    // SpanScores: Per-span scores.
    SpanScores []*SpanScore `json:"spanScores,omitempty"`

    // SummaryScore: Overall score for comment as a whole.
    SummaryScore *Score `json:"summaryScore,omitempty"`

    // ForceSendFields is a list of field names (e.g. "SpanScores") to
    // unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "SpanScores") to include in
    // API requests with the JSON null value. By default, fields with empty
    // values are omitted from API requests. However, any field with an
    // empty value appearing in NullFields will be sent to the server as
    // null. It is an error if a field in this list has a non-empty value.
    // This may be used to include null fields in Patch requests.
    NullFields []string `json:"-"`
}

func (*AttributeScores) MarshalJSON

func (s *AttributeScores) MarshalJSON() ([]byte, error)

type CommentsAnalyzeCall

type CommentsAnalyzeCall struct {
    // contains filtered or unexported fields
}

func (*CommentsAnalyzeCall) Context

func (c *CommentsAnalyzeCall) Context(ctx context.Context) *CommentsAnalyzeCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*CommentsAnalyzeCall) Do

func (c *CommentsAnalyzeCall) Do(opts ...googleapi.CallOption) (*AnalyzeCommentResponse, error)

Do executes the "commentanalyzer.comments.analyze" call. Exactly one of *AnalyzeCommentResponse or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *AnalyzeCommentResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*CommentsAnalyzeCall) Fields

func (c *CommentsAnalyzeCall) Fields(s ...googleapi.Field) *CommentsAnalyzeCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*CommentsAnalyzeCall) Header

func (c *CommentsAnalyzeCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type CommentsService

type CommentsService struct {
    // contains filtered or unexported fields
}

func NewCommentsService

func NewCommentsService(s *Service) *CommentsService

func (*CommentsService) Analyze

func (r *CommentsService) Analyze(analyzecommentrequest *AnalyzeCommentRequest) *CommentsAnalyzeCall

Analyze: Analyzes the provided text and returns scores for requested attributes.

func (*CommentsService) Suggestscore

func (r *CommentsService) Suggestscore(suggestcommentscorerequest *SuggestCommentScoreRequest) *CommentsSuggestscoreCall

Suggestscore: Suggest comment scores as training data.

type CommentsSuggestscoreCall

type CommentsSuggestscoreCall struct {
    // contains filtered or unexported fields
}

func (*CommentsSuggestscoreCall) Context

func (c *CommentsSuggestscoreCall) Context(ctx context.Context) *CommentsSuggestscoreCall

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*CommentsSuggestscoreCall) Do

func (c *CommentsSuggestscoreCall) Do(opts ...googleapi.CallOption) (*SuggestCommentScoreResponse, error)

Do executes the "commentanalyzer.comments.suggestscore" call. Exactly one of *SuggestCommentScoreResponse or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *SuggestCommentScoreResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*CommentsSuggestscoreCall) Fields

func (c *CommentsSuggestscoreCall) Fields(s ...googleapi.Field) *CommentsSuggestscoreCall

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*CommentsSuggestscoreCall) Header

func (c *CommentsSuggestscoreCall) Header() http.Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type Context

Context: Context is typically something that a Comment is referencing or replying to (such as an article, or previous comment). Note: Populate only ONE OF the following fields. The oneof syntax cannot be used because that would require nesting entries inside another message and breaking backwards compatibility. The server will return an error if more than one of the following fields is present.

type Context struct {
    // ArticleAndParentComment: Information about the source for which the
    // original comment was made, and
    // any parent comment info.
    ArticleAndParentComment *ArticleAndParentComment `json:"articleAndParentComment,omitempty"`

    // Entries: A list of messages. For example, a linear comments section
    // or forum thread.
    Entries []*TextEntry `json:"entries,omitempty"`

    // ForceSendFields is a list of field names (e.g.
    // "ArticleAndParentComment") to unconditionally include in API
    // requests. By default, fields with empty values are omitted from API
    // requests. However, any non-pointer, non-interface field appearing in
    // ForceSendFields will be sent to the server regardless of whether the
    // field is empty or not. This may be used to include empty fields in
    // Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "ArticleAndParentComment")
    // to include in API requests with the JSON null value. By default,
    // fields with empty values are omitted from API requests. However, any
    // field with an empty value appearing in NullFields will be sent to the
    // server as null. It is an error if a field in this list has a
    // non-empty value. This may be used to include null fields in Patch
    // requests.
    NullFields []string `json:"-"`
}

func (*Context) MarshalJSON

func (s *Context) MarshalJSON() ([]byte, error)

type Score

Score: Analysis scores are described by a value and a ScoreType.

type Score struct {
    // Type: The type of the above value.
    //
    // Possible values:
    //   "SCORE_TYPE_UNSPECIFIED" - Unspecified. Defaults to PROBABILITY
    // scores if available, and otherwise
    // RAW. Every model has a RAW score.
    //   "PROBABILITY" - Probability scores are in the range [0, 1] and
    // indicate level of confidence
    // in the attribute label.
    //   "STD_DEV_SCORE" - Standard deviation scores are in the range (-inf,
    // +inf).
    //   "PERCENTILE" - Percentile scores are in the range [0, 1] and
    // indicate the percentile of
    // the raw score, normalized with a test dataset. This is not
    // generally
    // recommended, as the normalization is dependent on the dataset used,
    // which
    // may not match other usecases.
    //   "RAW" - Raw scores are the raw values from the model, and may take
    // any value. This
    // is primarily for debugging/testing, and not generally recommended.
    Type string `json:"type,omitempty"`

    // Value: Score value. Semantics described by type below.
    Value float64 `json:"value,omitempty"`

    // ForceSendFields is a list of field names (e.g. "Type") to
    // unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "Type") to include in API
    // requests with the JSON null value. By default, fields with empty
    // values are omitted from API requests. However, any field with an
    // empty value appearing in NullFields will be sent to the server as
    // null. It is an error if a field in this list has a non-empty value.
    // This may be used to include null fields in Patch requests.
    NullFields []string `json:"-"`
}

func (*Score) MarshalJSON

func (s *Score) MarshalJSON() ([]byte, error)

func (*Score) UnmarshalJSON

func (s *Score) UnmarshalJSON(data []byte) error

type Service

type Service struct {
    BasePath  string // API endpoint base URL
    UserAgent string // optional additional User-Agent fragment

    Comments *CommentsService
    // contains filtered or unexported fields
}

func New

func New(client *http.Client) (*Service, error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

func NewService

func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)

NewService creates a new Service.

type SpanScore

SpanScore: This is a single score for a given span of text.

type SpanScore struct {
    // Begin: "begin" and "end" describe the span of the original text that
    // the attribute
    // score applies to. The values are the UTF-16 codepoint range. "end"
    // is
    // exclusive. For example, with the text "Hi there", the begin/end pair
    // (0,2)
    // describes the text "Hi".
    //
    // If "begin" and "end" are unset, the score applies to the full text.
    Begin int64 `json:"begin,omitempty"`

    End int64 `json:"end,omitempty"`

    // Score: The score value.
    Score *Score `json:"score,omitempty"`

    // ForceSendFields is a list of field names (e.g. "Begin") to
    // unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "Begin") to include in API
    // requests with the JSON null value. By default, fields with empty
    // values are omitted from API requests. However, any field with an
    // empty value appearing in NullFields will be sent to the server as
    // null. It is an error if a field in this list has a non-empty value.
    // This may be used to include null fields in Patch requests.
    NullFields []string `json:"-"`
}

func (*SpanScore) MarshalJSON

func (s *SpanScore) MarshalJSON() ([]byte, error)

type SuggestCommentScoreRequest

SuggestCommentScoreRequest: The comment score suggestion request message.

type SuggestCommentScoreRequest struct {
    // AttributeScores: Attribute scores for the comment. The map keys are
    // attribute names, same as
    // the requested_attribute field in AnalyzeCommentRequest (for
    // example
    // "ATTACK_ON_AUTHOR", "INFLAMMATORY", etc.). This field has the same
    // type as
    // the `attribute_scores` field in AnalyzeCommentResponse.
    //
    // To specify an overall attribute score for the entire comment as a
    // whole,
    // use the `summary_score` field of the mapped AttributeScores object.
    // To
    // specify scores on specific subparts of the comment, use the
    // `span_scores`
    // field. All SpanScore objects must have begin and end fields set.
    //
    // All Score objects must be explicitly set (for binary classification,
    // use
    // the score values 0 and 1). If Score objects don't include a
    // ScoreType,
    // `PROBABILITY` is assumed.
    //
    // `attribute_scores` must not be empty. The mapped AttributeScores
    // objects
    // also must not be empty. An `INVALID_ARGUMENT` error is returned for
    // all
    // malformed requests.
    AttributeScores map[string]AttributeScores `json:"attributeScores,omitempty"`

    // ClientToken: Opaque token that is echoed from the request to the
    // response.
    ClientToken string `json:"clientToken,omitempty"`

    // Comment: The comment being scored.
    Comment *TextEntry `json:"comment,omitempty"`

    // CommunityId: Optional identifier associating this comment score
    // suggestion with a
    // particular sub-community. Different communities may have different
    // norms
    // and rules. Specifying this value enables training
    // community-specific
    // models.
    CommunityId string `json:"communityId,omitempty"`

    // Context: The context of the comment.
    Context *Context `json:"context,omitempty"`

    // Languages: The language(s) of the comment and context. If none are
    // specified, we
    // attempt to automatically detect the language. Both ISO and BCP-47
    // language
    // codes are accepted.
    Languages []string `json:"languages,omitempty"`

    // SessionId: Session ID. Used to join related RPCs into a single
    // session. For example,
    // an interactive tool that calls both the AnalyzeComment
    // and
    // SuggestCommentScore RPCs should set all invocations of both RPCs to
    // the
    // same Session ID, typically a random 64-bit integer.
    SessionId string `json:"sessionId,omitempty"`

    // ForceSendFields is a list of field names (e.g. "AttributeScores") to
    // unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "AttributeScores") to
    // include in API requests with the JSON null value. By default, fields
    // with empty values are omitted from API requests. However, any field
    // with an empty value appearing in NullFields will be sent to the
    // server as null. It is an error if a field in this list has a
    // non-empty value. This may be used to include null fields in Patch
    // requests.
    NullFields []string `json:"-"`
}

func (*SuggestCommentScoreRequest) MarshalJSON

func (s *SuggestCommentScoreRequest) MarshalJSON() ([]byte, error)

type SuggestCommentScoreResponse

SuggestCommentScoreResponse: The comment score suggestion response message.

type SuggestCommentScoreResponse struct {
    // ClientToken: Same token from the original SuggestCommentScoreRequest.
    ClientToken string `json:"clientToken,omitempty"`

    // DetectedLanguages: The list of languages detected from the comment
    // text.
    DetectedLanguages []string `json:"detectedLanguages,omitempty"`

    // RequestedLanguages: The list of languages provided in the request.
    RequestedLanguages []string `json:"requestedLanguages,omitempty"`

    // ServerResponse contains the HTTP response code and headers from the
    // server.
    googleapi.ServerResponse `json:"-"`

    // ForceSendFields is a list of field names (e.g. "ClientToken") to
    // unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "ClientToken") to include
    // in API requests with the JSON null value. By default, fields with
    // empty values are omitted from API requests. However, any field with
    // an empty value appearing in NullFields will be sent to the server as
    // null. It is an error if a field in this list has a non-empty value.
    // This may be used to include null fields in Patch requests.
    NullFields []string `json:"-"`
}

func (*SuggestCommentScoreResponse) MarshalJSON

func (s *SuggestCommentScoreResponse) MarshalJSON() ([]byte, error)

type TextEntry

TextEntry: Represents a body of text.

type TextEntry struct {
    // Text: UTF-8 encoded text.
    Text string `json:"text,omitempty"`

    // Type: Type of the text field.
    //
    // Possible values:
    //   "TEXT_TYPE_UNSPECIFIED" - The content type is not specified. Text
    // will be interpreted as plain text
    // by default.
    //   "PLAIN_TEXT" - Plain text.
    //   "HTML" - HTML.
    Type string `json:"type,omitempty"`

    // ForceSendFields is a list of field names (e.g. "Text") to
    // unconditionally include in API requests. By default, fields with
    // empty values are omitted from API requests. However, any non-pointer,
    // non-interface field appearing in ForceSendFields will be sent to the
    // server regardless of whether the field is empty or not. This may be
    // used to include empty fields in Patch requests.
    ForceSendFields []string `json:"-"`

    // NullFields is a list of field names (e.g. "Text") to include in API
    // requests with the JSON null value. By default, fields with empty
    // values are omitted from API requests. However, any field with an
    // empty value appearing in NullFields will be sent to the server as
    // null. It is an error if a field in this list has a non-empty value.
    // This may be used to include null fields in Patch requests.
    NullFields []string `json:"-"`
}

func (*TextEntry) MarshalJSON

func (s *TextEntry) MarshalJSON() ([]byte, error)