Documentation
¶
Overview ¶
Package naturallanguageunderstandingv1 : Operations and models for the NaturalLanguageUnderstandingV1 service
Index ¶
- Constants
- type AnalysisResults
- type AnalysisResultsMetadata
- type AnalysisResultsUsage
- type AnalyzeOptions
- func (options *AnalyzeOptions) SetClean(clean bool) *AnalyzeOptions
- func (options *AnalyzeOptions) SetFallbackToRaw(fallbackToRaw bool) *AnalyzeOptions
- func (options *AnalyzeOptions) SetFeatures(features *Features) *AnalyzeOptions
- func (options *AnalyzeOptions) SetHTML(HTML string) *AnalyzeOptions
- func (options *AnalyzeOptions) SetHeaders(param map[string]string) *AnalyzeOptions
- func (options *AnalyzeOptions) SetLanguage(language string) *AnalyzeOptions
- func (options *AnalyzeOptions) SetLimitTextCharacters(limitTextCharacters int64) *AnalyzeOptions
- func (options *AnalyzeOptions) SetReturnAnalyzedText(returnAnalyzedText bool) *AnalyzeOptions
- func (options *AnalyzeOptions) SetText(text string) *AnalyzeOptions
- func (options *AnalyzeOptions) SetURL(URL string) *AnalyzeOptions
- func (options *AnalyzeOptions) SetXpath(xpath string) *AnalyzeOptions
- type Author
- type CategoriesOptions
- type CategoriesRelevantText
- type CategoriesResult
- type CategoriesResultExplanation
- type ConceptsOptions
- type ConceptsResult
- type DeleteModelOptions
- type DeleteModelResults
- type DisambiguationResult
- type DocumentEmotionResults
- type DocumentSentimentResults
- type EmotionOptions
- type EmotionResult
- type EmotionScores
- type EntitiesOptions
- type EntitiesResult
- type EntityMention
- type FeatureSentimentResults
- type Features
- type Feed
- type KeywordsOptions
- type KeywordsResult
- type ListModelsOptions
- type ListModelsResults
- type MetadataOptions
- type Model
- type NaturalLanguageUnderstandingV1
- func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) Analyze(analyzeOptions *AnalyzeOptions) (result *AnalysisResults, response *core.DetailedResponse, err error)
- func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) DeleteModel(deleteModelOptions *DeleteModelOptions) (result *DeleteModelResults, response *core.DetailedResponse, err error)
- func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) DisableSSLVerification()
- func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) ListModels(listModelsOptions *ListModelsOptions) (result *ListModelsResults, response *core.DetailedResponse, err error)
- func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) NewAnalyzeOptions(features *Features) *AnalyzeOptions
- func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) NewDeleteModelOptions(modelID string) *DeleteModelOptions
- func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) NewListModelsOptions() *ListModelsOptions
- func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) SetServiceURL(url string) error
- type NaturalLanguageUnderstandingV1Options
- type RelationArgument
- type RelationEntity
- type RelationsOptions
- type RelationsResult
- type SemanticRolesEntity
- type SemanticRolesKeyword
- type SemanticRolesOptions
- type SemanticRolesResult
- type SemanticRolesResultAction
- type SemanticRolesResultObject
- type SemanticRolesResultSubject
- type SemanticRolesVerb
- type SentenceResult
- type SentimentOptions
- type SentimentResult
- type SyntaxOptions
- type SyntaxOptionsTokens
- type SyntaxResult
- type TargetedEmotionResults
- type TargetedSentimentResults
- type TokenResult
Constants ¶
const ( Model_Status_Available = "available" Model_Status_Deleted = "deleted" Model_Status_Deploying = "deploying" Model_Status_Error = "error" Model_Status_Starting = "starting" Model_Status_Training = "training" )
Constants associated with the Model.Status property. When the status is `available`, the model is ready to use.
const ( TokenResult_PartOfSpeech_Adj = "ADJ" TokenResult_PartOfSpeech_Adp = "ADP" TokenResult_PartOfSpeech_Adv = "ADV" TokenResult_PartOfSpeech_Aux = "AUX" TokenResult_PartOfSpeech_Cconj = "CCONJ" TokenResult_PartOfSpeech_Det = "DET" TokenResult_PartOfSpeech_Intj = "INTJ" TokenResult_PartOfSpeech_Noun = "NOUN" TokenResult_PartOfSpeech_Num = "NUM" TokenResult_PartOfSpeech_Part = "PART" TokenResult_PartOfSpeech_Pron = "PRON" TokenResult_PartOfSpeech_Propn = "PROPN" TokenResult_PartOfSpeech_Punct = "PUNCT" TokenResult_PartOfSpeech_Sconj = "SCONJ" TokenResult_PartOfSpeech_Sym = "SYM" TokenResult_PartOfSpeech_Verb = "VERB" TokenResult_PartOfSpeech_X = "X" )
Constants associated with the TokenResult.PartOfSpeech property. The part of speech of the token. For more information about the values, see [Universal Dependencies POS tags](https://universaldependencies.org/u/pos/).
const DefaultServiceName = "natural-language-understanding"
DefaultServiceName is the default key used to find external configuration information.
const DefaultServiceURL = "https://api.us-south.natural-language-understanding.watson.cloud.ibm.com"
DefaultServiceURL is the default URL to make service requests to.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalysisResults ¶
type AnalysisResults struct { // Language used to analyze the text. Language *string `json:"language,omitempty"` // Text that was used in the analysis. AnalyzedText *string `json:"analyzed_text,omitempty"` // URL of the webpage that was analyzed. RetrievedURL *string `json:"retrieved_url,omitempty"` // API usage information for the request. Usage *AnalysisResultsUsage `json:"usage,omitempty"` // The general concepts referenced or alluded to in the analyzed text. Concepts []ConceptsResult `json:"concepts,omitempty"` // The entities detected in the analyzed text. Entities []EntitiesResult `json:"entities,omitempty"` // The keywords from the analyzed text. Keywords []KeywordsResult `json:"keywords,omitempty"` // The categories that the service assigned to the analyzed text. Categories []CategoriesResult `json:"categories,omitempty"` // The anger, disgust, fear, joy, or sadness conveyed by the content. Emotion *EmotionResult `json:"emotion,omitempty"` // Webpage metadata, such as the author and the title of the page. Metadata *AnalysisResultsMetadata `json:"metadata,omitempty"` // The relationships between entities in the content. Relations []RelationsResult `json:"relations,omitempty"` // Sentences parsed into `subject`, `action`, and `object` form. SemanticRoles []SemanticRolesResult `json:"semantic_roles,omitempty"` // The sentiment of the content. Sentiment *SentimentResult `json:"sentiment,omitempty"` // Tokens and sentences returned from syntax analysis. Syntax *SyntaxResult `json:"syntax,omitempty"` }
AnalysisResults : Results of the analysis, organized by feature.
type AnalysisResultsMetadata ¶ added in v0.7.0
type AnalysisResultsMetadata struct { // The authors of the document. Authors []Author `json:"authors,omitempty"` // The publication date in the format ISO 8601. PublicationDate *string `json:"publication_date,omitempty"` // The title of the document. Title *string `json:"title,omitempty"` // URL of a prominent image on the webpage. Image *string `json:"image,omitempty"` // RSS/ATOM feeds found on the webpage. Feeds []Feed `json:"feeds,omitempty"` }
AnalysisResultsMetadata : Webpage metadata, such as the author and the title of the page.
type AnalysisResultsUsage ¶ added in v0.7.0
type AnalysisResultsUsage struct { // Number of features used in the API call. Features *int64 `json:"features,omitempty"` // Number of text characters processed. TextCharacters *int64 `json:"text_characters,omitempty"` // Number of 10,000-character units processed. TextUnits *int64 `json:"text_units,omitempty"` }
AnalysisResultsUsage : API usage information for the request.
type AnalyzeOptions ¶
type AnalyzeOptions struct { // Specific features to analyze the document for. Features *Features `json:"features" validate:"required"` // The plain text to analyze. One of the `text`, `html`, or `url` parameters is required. Text *string `json:"text,omitempty"` // The HTML file to analyze. One of the `text`, `html`, or `url` parameters is required. HTML *string `json:"html,omitempty"` // The webpage to analyze. One of the `text`, `html`, or `url` parameters is required. URL *string `json:"url,omitempty"` // Set this to `false` to disable webpage cleaning. For more information about webpage cleaning, see [Analyzing // webpages](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages). Clean *bool `json:"clean,omitempty"` // An [XPath // query](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-analyzing-webpages#xpath) // to perform on `html` or `url` input. Results of the query will be appended to the cleaned webpage text before it is // analyzed. To analyze only the results of the XPath query, set the `clean` parameter to `false`. Xpath *string `json:"xpath,omitempty"` // Whether to use raw HTML content if text cleaning fails. FallbackToRaw *bool `json:"fallback_to_raw,omitempty"` // Whether or not to return the analyzed text. ReturnAnalyzedText *bool `json:"return_analyzed_text,omitempty"` // ISO 639-1 code that specifies the language of your text. This overrides automatic language detection. Language // support differs depending on the features you include in your analysis. For more information, see [Language // support](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-language-support). Language *string `json:"language,omitempty"` // Sets the maximum number of characters that are processed by the service. LimitTextCharacters *int64 `json:"limit_text_characters,omitempty"` // Allows users to set headers to be GDPR compliant Headers map[string]string }
AnalyzeOptions : The Analyze options.
func (*AnalyzeOptions) SetClean ¶
func (options *AnalyzeOptions) SetClean(clean bool) *AnalyzeOptions
SetClean : Allow user to set Clean
func (*AnalyzeOptions) SetFallbackToRaw ¶
func (options *AnalyzeOptions) SetFallbackToRaw(fallbackToRaw bool) *AnalyzeOptions
SetFallbackToRaw : Allow user to set FallbackToRaw
func (*AnalyzeOptions) SetFeatures ¶
func (options *AnalyzeOptions) SetFeatures(features *Features) *AnalyzeOptions
SetFeatures : Allow user to set Features
func (*AnalyzeOptions) SetHTML ¶
func (options *AnalyzeOptions) SetHTML(HTML string) *AnalyzeOptions
SetHTML : Allow user to set HTML
func (*AnalyzeOptions) SetHeaders ¶
func (options *AnalyzeOptions) SetHeaders(param map[string]string) *AnalyzeOptions
SetHeaders : Allow user to set Headers
func (*AnalyzeOptions) SetLanguage ¶
func (options *AnalyzeOptions) SetLanguage(language string) *AnalyzeOptions
SetLanguage : Allow user to set Language
func (*AnalyzeOptions) SetLimitTextCharacters ¶
func (options *AnalyzeOptions) SetLimitTextCharacters(limitTextCharacters int64) *AnalyzeOptions
SetLimitTextCharacters : Allow user to set LimitTextCharacters
func (*AnalyzeOptions) SetReturnAnalyzedText ¶
func (options *AnalyzeOptions) SetReturnAnalyzedText(returnAnalyzedText bool) *AnalyzeOptions
SetReturnAnalyzedText : Allow user to set ReturnAnalyzedText
func (*AnalyzeOptions) SetText ¶
func (options *AnalyzeOptions) SetText(text string) *AnalyzeOptions
SetText : Allow user to set Text
func (*AnalyzeOptions) SetURL ¶
func (options *AnalyzeOptions) SetURL(URL string) *AnalyzeOptions
SetURL : Allow user to set URL
func (*AnalyzeOptions) SetXpath ¶
func (options *AnalyzeOptions) SetXpath(xpath string) *AnalyzeOptions
SetXpath : Allow user to set Xpath
type Author ¶
type Author struct { // Name of the author. Name *string `json:"name,omitempty"` }
Author : The author of the analyzed content.
type CategoriesOptions ¶
type CategoriesOptions struct { // Set this to `true` to return explanations for each categorization. **This is available only for English // categories.**. Explanation *bool `json:"explanation,omitempty"` // Maximum number of categories to return. Limit *int64 `json:"limit,omitempty"` // Enter a [custom // model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) // ID to override the standard categories model. // // The custom categories experimental feature will be retired on 19 December 2019. On that date, deployed custom // categories models will no longer be accessible in Natural Language Understanding. The feature will be removed from // Knowledge Studio on an earlier date. Custom categories models will no longer be accessible in Knowledge Studio on 17 // December 2019. Model *string `json:"model,omitempty"` }
CategoriesOptions : Returns a five-level taxonomy of the content. The top three categories are returned.
Supported languages: Arabic, English, French, German, Italian, Japanese, Korean, Portuguese, Spanish.
type CategoriesRelevantText ¶ added in v0.9.0
type CategoriesRelevantText struct { // Text from the analyzed source that supports the categorization. Text *string `json:"text,omitempty"` }
CategoriesRelevantText : Relevant text that contributed to the categorization.
type CategoriesResult ¶
type CategoriesResult struct { // The path to the category through the 5-level taxonomy hierarchy. For more information about the categories, see // [Categories // hierarchy](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-categories#categories-hierarchy). Label *string `json:"label,omitempty"` // Confidence score for the category classification. Higher values indicate greater confidence. Score *float64 `json:"score,omitempty"` // Information that helps to explain what contributed to the categories result. Explanation *CategoriesResultExplanation `json:"explanation,omitempty"` }
CategoriesResult : A categorization of the analyzed text.
type CategoriesResultExplanation ¶ added in v0.9.0
type CategoriesResultExplanation struct { // An array of relevant text from the source that contributed to the categorization. The sorted array begins with the // phrase that contributed most significantly to the result, followed by phrases that were less and less impactful. RelevantText []CategoriesRelevantText `json:"relevant_text,omitempty"` }
CategoriesResultExplanation : Information that helps to explain what contributed to the categories result.
type ConceptsOptions ¶
type ConceptsOptions struct { // Maximum number of concepts to return. Limit *int64 `json:"limit,omitempty"` }
ConceptsOptions : Returns high-level concepts in the content. For example, a research paper about deep learning might return the concept, "Artificial Intelligence" although the term is not mentioned.
Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Spanish.
type ConceptsResult ¶
type ConceptsResult struct { // Name of the concept. Text *string `json:"text,omitempty"` // Relevance score between 0 and 1. Higher scores indicate greater relevance. Relevance *float64 `json:"relevance,omitempty"` // Link to the corresponding DBpedia resource. DbpediaResource *string `json:"dbpedia_resource,omitempty"` }
ConceptsResult : The general concepts referenced or alluded to in the analyzed text.
type DeleteModelOptions ¶
type DeleteModelOptions struct { // Model ID of the model to delete. ModelID *string `json:"model_id" validate:"required"` // Allows users to set headers to be GDPR compliant Headers map[string]string }
DeleteModelOptions : The DeleteModel options.
func (*DeleteModelOptions) SetHeaders ¶
func (options *DeleteModelOptions) SetHeaders(param map[string]string) *DeleteModelOptions
SetHeaders : Allow user to set Headers
func (*DeleteModelOptions) SetModelID ¶
func (options *DeleteModelOptions) SetModelID(modelID string) *DeleteModelOptions
SetModelID : Allow user to set ModelID
type DeleteModelResults ¶
type DeleteModelResults struct { // model_id of the deleted model. Deleted *string `json:"deleted,omitempty"` }
DeleteModelResults : Delete model results.
type DisambiguationResult ¶
type DisambiguationResult struct { // Common entity name. Name *string `json:"name,omitempty"` // Link to the corresponding DBpedia resource. DbpediaResource *string `json:"dbpedia_resource,omitempty"` // Entity subtype information. Subtype []string `json:"subtype,omitempty"` }
DisambiguationResult : Disambiguation information for the entity.
type DocumentEmotionResults ¶
type DocumentEmotionResults struct { // Emotion results for the document as a whole. Emotion *EmotionScores `json:"emotion,omitempty"` }
DocumentEmotionResults : Emotion results for the document as a whole.
type DocumentSentimentResults ¶
type DocumentSentimentResults struct { // Indicates whether the sentiment is positive, neutral, or negative. Label *string `json:"label,omitempty"` // Sentiment score from -1 (negative) to 1 (positive). Score *float64 `json:"score,omitempty"` }
DocumentSentimentResults : DocumentSentimentResults struct
type EmotionOptions ¶
type EmotionOptions struct { // Set this to `false` to hide document-level emotion results. Document *bool `json:"document,omitempty"` // Emotion results will be returned for each target string that is found in the document. Targets []string `json:"targets,omitempty"` }
EmotionOptions : Detects anger, disgust, fear, joy, or sadness that is conveyed in the content or by the context around target phrases specified in the targets parameter. You can analyze emotion for detected entities with `entities.emotion` and for keywords with `keywords.emotion`.
Supported languages: English.
type EmotionResult ¶
type EmotionResult struct { // Emotion results for the document as a whole. Document *DocumentEmotionResults `json:"document,omitempty"` // Emotion results for specified targets. Targets []TargetedEmotionResults `json:"targets,omitempty"` }
EmotionResult : The detected anger, disgust, fear, joy, or sadness that is conveyed by the content. Emotion information can be returned for detected entities, keywords, or user-specified target phrases found in the text.
type EmotionScores ¶
type EmotionScores struct { // Anger score from 0 to 1. A higher score means that the text is more likely to convey anger. Anger *float64 `json:"anger,omitempty"` // Disgust score from 0 to 1. A higher score means that the text is more likely to convey disgust. Disgust *float64 `json:"disgust,omitempty"` // Fear score from 0 to 1. A higher score means that the text is more likely to convey fear. Fear *float64 `json:"fear,omitempty"` // Joy score from 0 to 1. A higher score means that the text is more likely to convey joy. Joy *float64 `json:"joy,omitempty"` // Sadness score from 0 to 1. A higher score means that the text is more likely to convey sadness. Sadness *float64 `json:"sadness,omitempty"` }
EmotionScores : EmotionScores struct
type EntitiesOptions ¶
type EntitiesOptions struct { // Maximum number of entities to return. Limit *int64 `json:"limit,omitempty"` // Set this to `true` to return locations of entity mentions. Mentions *bool `json:"mentions,omitempty"` // Enter a [custom // model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) // ID to override the standard entity detection model. Model *string `json:"model,omitempty"` // Set this to `true` to return sentiment information for detected entities. Sentiment *bool `json:"sentiment,omitempty"` // Set this to `true` to analyze emotion for detected keywords. Emotion *bool `json:"emotion,omitempty"` }
EntitiesOptions : Identifies people, cities, organizations, and other entities in the content. For more information, see [Entity types and subtypes](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-entity-types).
Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish. Arabic, Chinese, and Dutch are supported only through custom models.
type EntitiesResult ¶
type EntitiesResult struct { // Entity type. Type *string `json:"type,omitempty"` // The name of the entity. Text *string `json:"text,omitempty"` // Relevance score from 0 to 1. Higher values indicate greater relevance. Relevance *float64 `json:"relevance,omitempty"` // Confidence in the entity identification from 0 to 1. Higher values indicate higher confidence. In standard entities // requests, confidence is returned only for English text. All entities requests that use custom models return the // confidence score. Confidence *float64 `json:"confidence,omitempty"` // Entity mentions and locations. Mentions []EntityMention `json:"mentions,omitempty"` // How many times the entity was mentioned in the text. Count *int64 `json:"count,omitempty"` // Emotion analysis results for the entity, enabled with the `emotion` option. Emotion *EmotionScores `json:"emotion,omitempty"` // Sentiment analysis results for the entity, enabled with the `sentiment` option. Sentiment *FeatureSentimentResults `json:"sentiment,omitempty"` // Disambiguation information for the entity. Disambiguation *DisambiguationResult `json:"disambiguation,omitempty"` }
EntitiesResult : The important people, places, geopolitical entities and other types of entities in your content.
type EntityMention ¶
type EntityMention struct { // Entity mention text. Text *string `json:"text,omitempty"` // Character offsets indicating the beginning and end of the mention in the analyzed text. Location []int64 `json:"location,omitempty"` // Confidence in the entity identification from 0 to 1. Higher values indicate higher confidence. In standard entities // requests, confidence is returned only for English text. All entities requests that use custom models return the // confidence score. Confidence *float64 `json:"confidence,omitempty"` }
EntityMention : EntityMention struct
type FeatureSentimentResults ¶
type FeatureSentimentResults struct { // Sentiment score from -1 (negative) to 1 (positive). Score *float64 `json:"score,omitempty"` }
FeatureSentimentResults : FeatureSentimentResults struct
type Features ¶
type Features struct { // Returns high-level concepts in the content. For example, a research paper about deep learning might return the // concept, "Artificial Intelligence" although the term is not mentioned. // // Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Spanish. Concepts *ConceptsOptions `json:"concepts,omitempty"` // Detects anger, disgust, fear, joy, or sadness that is conveyed in the content or by the context around target // phrases specified in the targets parameter. You can analyze emotion for detected entities with `entities.emotion` // and for keywords with `keywords.emotion`. // // Supported languages: English. Emotion *EmotionOptions `json:"emotion,omitempty"` // Identifies people, cities, organizations, and other entities in the content. For more information, see [Entity types // and // subtypes](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-entity-types). // // Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish. // Arabic, Chinese, and Dutch are supported only through custom models. Entities *EntitiesOptions `json:"entities,omitempty"` // Returns important keywords in the content. // // Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish. Keywords *KeywordsOptions `json:"keywords,omitempty"` // Returns information from the document, including author name, title, RSS/ATOM feeds, prominent page image, and // publication date. Supports URL and HTML input types only. Metadata *MetadataOptions `json:"metadata,omitempty"` // Recognizes when two entities are related and identifies the type of relation. For example, an `awardedTo` relation // might connect the entities "Nobel Prize" and "Albert Einstein". For more information, see [Relation // types](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-relations). // // Supported languages: Arabic, English, German, Japanese, Korean, Spanish. Chinese, Dutch, French, Italian, and // Portuguese custom models are also supported. Relations *RelationsOptions `json:"relations,omitempty"` // Parses sentences into subject, action, and object form. // // Supported languages: English, German, Japanese, Korean, Spanish. SemanticRoles *SemanticRolesOptions `json:"semantic_roles,omitempty"` // Analyzes the general sentiment of your content or the sentiment toward specific target phrases. You can analyze // sentiment for detected entities with `entities.sentiment` and for keywords with `keywords.sentiment`. // // Supported languages: Arabic, English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish. Sentiment *SentimentOptions `json:"sentiment,omitempty"` // Returns a five-level taxonomy of the content. The top three categories are returned. // // Supported languages: Arabic, English, French, German, Italian, Japanese, Korean, Portuguese, Spanish. Categories *CategoriesOptions `json:"categories,omitempty"` // Returns tokens and sentences from the input text. Syntax *SyntaxOptions `json:"syntax,omitempty"` }
Features : Analysis features and options.
type Feed ¶
type Feed struct { // URL of the RSS or ATOM feed. Link *string `json:"link,omitempty"` }
Feed : RSS or ATOM feed found on the webpage.
type KeywordsOptions ¶
type KeywordsOptions struct { // Maximum number of keywords to return. Limit *int64 `json:"limit,omitempty"` // Set this to `true` to return sentiment information for detected keywords. Sentiment *bool `json:"sentiment,omitempty"` // Set this to `true` to analyze emotion for detected keywords. Emotion *bool `json:"emotion,omitempty"` }
KeywordsOptions : Returns important keywords in the content.
Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish.
type KeywordsResult ¶
type KeywordsResult struct { // Number of times the keyword appears in the analyzed text. Count *int64 `json:"count,omitempty"` // Relevance score from 0 to 1. Higher values indicate greater relevance. Relevance *float64 `json:"relevance,omitempty"` // The keyword text. Text *string `json:"text,omitempty"` // Emotion analysis results for the keyword, enabled with the `emotion` option. Emotion *EmotionScores `json:"emotion,omitempty"` // Sentiment analysis results for the keyword, enabled with the `sentiment` option. Sentiment *FeatureSentimentResults `json:"sentiment,omitempty"` }
KeywordsResult : The important keywords in the content, organized by relevance.
type ListModelsOptions ¶
type ListModelsOptions struct { // Allows users to set headers to be GDPR compliant Headers map[string]string }
ListModelsOptions : The ListModels options.
func (*ListModelsOptions) SetHeaders ¶
func (options *ListModelsOptions) SetHeaders(param map[string]string) *ListModelsOptions
SetHeaders : Allow user to set Headers
type ListModelsResults ¶
type ListModelsResults struct { // An array of available models. Models []Model `json:"models,omitempty"` }
ListModelsResults : Custom models that are available for entities and relations.
type MetadataOptions ¶
type MetadataOptions struct { }
MetadataOptions : Returns information from the document, including author name, title, RSS/ATOM feeds, prominent page image, and publication date. Supports URL and HTML input types only.
type Model ¶
type Model struct { // When the status is `available`, the model is ready to use. Status *string `json:"status,omitempty"` // Unique model ID. ModelID *string `json:"model_id,omitempty"` // ISO 639-1 code that indicates the language of the model. Language *string `json:"language,omitempty"` // Model description. Description *string `json:"description,omitempty"` // ID of the Watson Knowledge Studio workspace that deployed this model to Natural Language Understanding. WorkspaceID *string `json:"workspace_id,omitempty"` // The model version, if it was manually provided in Watson Knowledge Studio. ModelVersion *string `json:"model_version,omitempty"` // (Deprecated — use `model_version`) The model version, if it was manually provided in Watson Knowledge Studio. Version *string `json:"version,omitempty"` // The description of the version, if it was manually provided in Watson Knowledge Studio. VersionDescription *string `json:"version_description,omitempty"` // A dateTime indicating when the model was created. Created *strfmt.DateTime `json:"created,omitempty"` }
Model : Model struct
type NaturalLanguageUnderstandingV1 ¶
type NaturalLanguageUnderstandingV1 struct { Service *core.BaseService Version string }
NaturalLanguageUnderstandingV1 : Analyze various features of text content at scale. Provide text, raw HTML, or a public URL and IBM Watson Natural Language Understanding will give you results for the features you request. The service cleans HTML content before analysis by default, so the results can ignore most advertisements and other unwanted content.
You can create [custom models](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) with Watson Knowledge Studio to detect custom entities and relations in Natural Language Understanding.
Version: 1.0 See: https://cloud.ibm.com/docs/natural-language-understanding/
func NewNaturalLanguageUnderstandingV1 ¶
func NewNaturalLanguageUnderstandingV1(options *NaturalLanguageUnderstandingV1Options) (service *NaturalLanguageUnderstandingV1, err error)
NewNaturalLanguageUnderstandingV1 : constructs an instance of NaturalLanguageUnderstandingV1 with passed in options.
func (*NaturalLanguageUnderstandingV1) Analyze ¶
func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) Analyze(analyzeOptions *AnalyzeOptions) (result *AnalysisResults, response *core.DetailedResponse, err error)
Analyze : Analyze text Analyzes text, HTML, or a public webpage for the following features: - Categories - Concepts - Emotion - Entities - Keywords - Metadata - Relations - Semantic roles - Sentiment - Syntax.
If a language for the input text is not specified with the `language` parameter, the service [automatically detects the language](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-detectable-languages).
func (*NaturalLanguageUnderstandingV1) DeleteModel ¶
func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) DeleteModel(deleteModelOptions *DeleteModelOptions) (result *DeleteModelResults, response *core.DetailedResponse, err error)
DeleteModel : Delete model Deletes a custom model.
func (*NaturalLanguageUnderstandingV1) DisableSSLVerification ¶ added in v1.0.0
func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) DisableSSLVerification()
DisableSSLVerification bypasses verification of the server's SSL certificate
func (*NaturalLanguageUnderstandingV1) ListModels ¶
func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) ListModels(listModelsOptions *ListModelsOptions) (result *ListModelsResults, response *core.DetailedResponse, err error)
ListModels : List models Lists Watson Knowledge Studio [custom entities and relations models](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) that are deployed to your Natural Language Understanding service.
func (*NaturalLanguageUnderstandingV1) NewAnalyzeOptions ¶
func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) NewAnalyzeOptions(features *Features) *AnalyzeOptions
NewAnalyzeOptions : Instantiate AnalyzeOptions
func (*NaturalLanguageUnderstandingV1) NewDeleteModelOptions ¶
func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) NewDeleteModelOptions(modelID string) *DeleteModelOptions
NewDeleteModelOptions : Instantiate DeleteModelOptions
func (*NaturalLanguageUnderstandingV1) NewListModelsOptions ¶
func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) NewListModelsOptions() *ListModelsOptions
NewListModelsOptions : Instantiate ListModelsOptions
func (*NaturalLanguageUnderstandingV1) SetServiceURL ¶ added in v1.0.0
func (naturalLanguageUnderstanding *NaturalLanguageUnderstandingV1) SetServiceURL(url string) error
SetServiceURL sets the service URL
type NaturalLanguageUnderstandingV1Options ¶
type NaturalLanguageUnderstandingV1Options struct { ServiceName string URL string Authenticator core.Authenticator Version string }
NaturalLanguageUnderstandingV1Options : Service options
type RelationArgument ¶
type RelationArgument struct { // An array of extracted entities. Entities []RelationEntity `json:"entities,omitempty"` // Character offsets indicating the beginning and end of the mention in the analyzed text. Location []int64 `json:"location,omitempty"` // Text that corresponds to the argument. Text *string `json:"text,omitempty"` }
RelationArgument : RelationArgument struct
type RelationEntity ¶
type RelationEntity struct { // Text that corresponds to the entity. Text *string `json:"text,omitempty"` // Entity type. Type *string `json:"type,omitempty"` }
RelationEntity : An entity that corresponds with an argument in a relation.
type RelationsOptions ¶
type RelationsOptions struct { // Enter a [custom // model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) // ID to override the default model. Model *string `json:"model,omitempty"` }
RelationsOptions : Recognizes when two entities are related and identifies the type of relation. For example, an `awardedTo` relation might connect the entities "Nobel Prize" and "Albert Einstein". For more information, see [Relation types](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-relations).
Supported languages: Arabic, English, German, Japanese, Korean, Spanish. Chinese, Dutch, French, Italian, and Portuguese custom models are also supported.
type RelationsResult ¶
type RelationsResult struct { // Confidence score for the relation. Higher values indicate greater confidence. Score *float64 `json:"score,omitempty"` // The sentence that contains the relation. Sentence *string `json:"sentence,omitempty"` // The type of the relation. Type *string `json:"type,omitempty"` // Entity mentions that are involved in the relation. Arguments []RelationArgument `json:"arguments,omitempty"` }
RelationsResult : The relations between entities found in the content.
type SemanticRolesEntity ¶
type SemanticRolesEntity struct { // Entity type. Type *string `json:"type,omitempty"` // The entity text. Text *string `json:"text,omitempty"` }
SemanticRolesEntity : SemanticRolesEntity struct
type SemanticRolesKeyword ¶
type SemanticRolesKeyword struct { // The keyword text. Text *string `json:"text,omitempty"` }
SemanticRolesKeyword : SemanticRolesKeyword struct
type SemanticRolesOptions ¶
type SemanticRolesOptions struct { // Maximum number of semantic_roles results to return. Limit *int64 `json:"limit,omitempty"` // Set this to `true` to return keyword information for subjects and objects. Keywords *bool `json:"keywords,omitempty"` // Set this to `true` to return entity information for subjects and objects. Entities *bool `json:"entities,omitempty"` }
SemanticRolesOptions : Parses sentences into subject, action, and object form.
Supported languages: English, German, Japanese, Korean, Spanish.
type SemanticRolesResult ¶
type SemanticRolesResult struct { // Sentence from the source that contains the subject, action, and object. Sentence *string `json:"sentence,omitempty"` // The extracted subject from the sentence. Subject *SemanticRolesResultSubject `json:"subject,omitempty"` // The extracted action from the sentence. Action *SemanticRolesResultAction `json:"action,omitempty"` // The extracted object from the sentence. Object *SemanticRolesResultObject `json:"object,omitempty"` }
SemanticRolesResult : The object containing the actions and the objects the actions act upon.
type SemanticRolesResultAction ¶ added in v0.7.0
type SemanticRolesResultAction struct { // Analyzed text that corresponds to the action. Text *string `json:"text,omitempty"` // normalized version of the action. Normalized *string `json:"normalized,omitempty"` Verb *SemanticRolesVerb `json:"verb,omitempty"` }
SemanticRolesResultAction : The extracted action from the sentence.
type SemanticRolesResultObject ¶ added in v0.7.0
type SemanticRolesResultObject struct { // Object text. Text *string `json:"text,omitempty"` // An array of extracted keywords. Keywords []SemanticRolesKeyword `json:"keywords,omitempty"` }
SemanticRolesResultObject : The extracted object from the sentence.
type SemanticRolesResultSubject ¶ added in v0.7.0
type SemanticRolesResultSubject struct { // Text that corresponds to the subject role. Text *string `json:"text,omitempty"` // An array of extracted entities. Entities []SemanticRolesEntity `json:"entities,omitempty"` // An array of extracted keywords. Keywords []SemanticRolesKeyword `json:"keywords,omitempty"` }
SemanticRolesResultSubject : The extracted subject from the sentence.
type SemanticRolesVerb ¶
type SemanticRolesVerb struct { // The keyword text. Text *string `json:"text,omitempty"` // Verb tense. Tense *string `json:"tense,omitempty"` }
SemanticRolesVerb : SemanticRolesVerb struct
type SentenceResult ¶ added in v0.7.0
type SentenceResult struct { // The sentence. Text *string `json:"text,omitempty"` // Character offsets indicating the beginning and end of the sentence in the analyzed text. Location []int64 `json:"location,omitempty"` }
SentenceResult : SentenceResult struct
type SentimentOptions ¶
type SentimentOptions struct { // Set this to `false` to hide document-level sentiment results. Document *bool `json:"document,omitempty"` // Sentiment results will be returned for each target string that is found in the document. Targets []string `json:"targets,omitempty"` }
SentimentOptions : Analyzes the general sentiment of your content or the sentiment toward specific target phrases. You can analyze sentiment for detected entities with `entities.sentiment` and for keywords with `keywords.sentiment`.
Supported languages: Arabic, English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish.
type SentimentResult ¶
type SentimentResult struct { // The document level sentiment. Document *DocumentSentimentResults `json:"document,omitempty"` // The targeted sentiment to analyze. Targets []TargetedSentimentResults `json:"targets,omitempty"` }
SentimentResult : The sentiment of the content.
type SyntaxOptions ¶ added in v0.7.0
type SyntaxOptions struct { // Tokenization options. Tokens *SyntaxOptionsTokens `json:"tokens,omitempty"` // Set this to `true` to return sentence information. Sentences *bool `json:"sentences,omitempty"` }
SyntaxOptions : Returns tokens and sentences from the input text.
type SyntaxOptionsTokens ¶ added in v0.7.0
type SyntaxOptionsTokens struct { // Set this to `true` to return the lemma for each token. Lemma *bool `json:"lemma,omitempty"` // Set this to `true` to return the part of speech for each token. PartOfSpeech *bool `json:"part_of_speech,omitempty"` }
SyntaxOptionsTokens : Tokenization options.
type SyntaxResult ¶ added in v0.7.0
type SyntaxResult struct { Tokens []TokenResult `json:"tokens,omitempty"` Sentences []SentenceResult `json:"sentences,omitempty"` }
SyntaxResult : Tokens and sentences returned from syntax analysis.
type TargetedEmotionResults ¶
type TargetedEmotionResults struct { // Targeted text. Text *string `json:"text,omitempty"` // The emotion results for the target. Emotion *EmotionScores `json:"emotion,omitempty"` }
TargetedEmotionResults : Emotion results for a specified target.
type TargetedSentimentResults ¶
type TargetedSentimentResults struct { // Targeted text. Text *string `json:"text,omitempty"` // Sentiment score from -1 (negative) to 1 (positive). Score *float64 `json:"score,omitempty"` }
TargetedSentimentResults : TargetedSentimentResults struct
type TokenResult ¶ added in v0.7.0
type TokenResult struct { // The token as it appears in the analyzed text. Text *string `json:"text,omitempty"` // The part of speech of the token. For more information about the values, see [Universal Dependencies POS // tags](https://universaldependencies.org/u/pos/). PartOfSpeech *string `json:"part_of_speech,omitempty"` // Character offsets indicating the beginning and end of the token in the analyzed text. Location []int64 `json:"location,omitempty"` // The [lemma](https://wikipedia.org/wiki/Lemma_%28morphology%29) of the token. Lemma *string `json:"lemma,omitempty"` }
TokenResult : TokenResult struct