glanguage

package
v0.0.0-...-9107137 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package glanguage contains some utilities for working with Google's Natural Language API.

Index

Constants

View Source
const (
	// Metadata keys in the entity entry
	// https://cloud.google.com/natural-language/docs/reference/rest/v1/Entity
	WikipediaKey = "wikipedia_url"
	MIDKey       = "mid"
)

Variables

This section is empty.

Functions

func GetMID

func GetMID(e languagepb.Entity) string

GetMID gets the mid (knowledge graph id ) from the entity if there is one otherwise returns the empty string.

func GetWikipediaURL

func GetWikipediaURL(e languagepb.Entity) string

GetWikipediaURL gets the wikipedia url from the entity if there is one otherwise returns the empty string.

Types

type MockLanguageServer

type MockLanguageServer struct {
	// Embed for forward compatibility.
	// Tests will keep working if more methods are added
	// in the future.
	languagepb.LanguageServiceServer

	Reqs []proto.Message

	// If set, all calls return this error.
	Err error

	// responses to return if Err == nil
	Resps []proto.Message
}

MockLanguageServer is a mock implementation to be used in tests.

Based on https://github.com/googleapis/google-cloud-go/blob/507a2be8e4fda152d517dcb972be6353a6da2914/language/apiv1/mock_test.go#L47

func (*MockLanguageServer) AnalyzeSyntax

func (*MockLanguageServer) AnnotateText

func (*MockLanguageServer) ClassifyText

Jump to

Keyboard shortcuts

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