func analyzeSentiment(ctx context.Context, client *language.Client, text string) (*languagepb.AnalyzeSentimentResponse, error) { return client.AnalyzeSentiment(ctx, &languagepb.AnalyzeSentimentRequest{ Document: &languagepb.Document{ Source: &languagepb.Document_Content{ Content: text, }, Type: languagepb.Document_PLAIN_TEXT, }, }) }
func analyzeEntities(ctx context.Context, client *language.Client, text string) (*languagepb.AnalyzeEntitiesResponse, error) { return client.AnalyzeEntities(ctx, &languagepb.AnalyzeEntitiesRequest{ Document: &languagepb.Document{ Source: &languagepb.Document_Content{ Content: text, }, Type: languagepb.Document_PLAIN_TEXT, }, EncodingType: languagepb.EncodingType_UTF8, }) }
func analyzeSyntax(ctx context.Context, client *language.Client, text string) (*languagepb.AnnotateTextResponse, error) { return client.AnnotateText(ctx, &languagepb.AnnotateTextRequest{ Document: &languagepb.Document{ Source: &languagepb.Document_Content{ Content: text, }, Type: languagepb.Document_PLAIN_TEXT, }, Features: &languagepb.AnnotateTextRequest_Features{ ExtractSyntax: true, }, EncodingType: languagepb.EncodingType_UTF8, }) }