santasentiment

command module
v0.0.0-...-37b211e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2020 License: MIT Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Google Cloud Natural Language API Go example

Authentication

  • Follow the instructions to set up your project and enable the Cloud Natural Language API.

  • From the Cloud Console, create a service account, download its json credentials file, then set the GOOGLE_APPLICATION_CREDENTIALS environment variable:

    export GOOGLE_APPLICATION_CREDENTIALS=/path/to/your-project-credentials.json
    

Run the sample

go build && ./analyze <command> <text>

Where command is entities, sentiment, or syntax.

For example:

go build && ./analyze entities "Renee French designed the Go gopher."

Prints something like this:

entities: <
  name: "Renee French"
  type: PERSON
  salience: 0.4693242
  mentions: <
    text: <
      content: "Renee French"
    >
  >
>
entities: <
  name: "Go"
  type: ORGANIZATION
  metadata: <
    key: "wikipedia_url"
    value: "http://en.wikipedia.org/wiki/Go_(programming_language)"
  >
  salience: 0.34126133
  mentions: <
    text: <
      content: "Go"
      begin_offset: 26
    >
  >
>
language: "en"

Documentation

Overview

Command analyze performs sentiment, entity, entity sentiment, and syntax analysis on a string of text via the Cloud Natural Language API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址