ibm_watson.natural_language_understanding_v1 module¶
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.
-
class
NaturalLanguageUnderstandingV1
(version: str, authenticator: Optional[ibm_cloud_sdk_core.authenticators.authenticator.Authenticator] = None, service_name: str = 'natural-language-understanding')[source]¶ Bases:
ibm_cloud_sdk_core.base_service.BaseService
The Natural Language Understanding V1 service.
-
DEFAULT_SERVICE_URL
= 'https://api.us-south.natural-language-understanding.watson.cloud.ibm.com'¶
-
DEFAULT_SERVICE_NAME
= 'natural-language-understanding'¶
-
analyze
(features: ibm_watson.natural_language_understanding_v1.Features, *, text: Optional[str] = None, html: Optional[str] = None, url: Optional[str] = None, clean: Optional[bool] = None, xpath: Optional[str] = None, fallback_to_raw: Optional[bool] = None, return_analyzed_text: Optional[bool] = None, language: Optional[str] = None, limit_text_characters: Optional[int] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Analyze text.
Analyzes text, HTML, or a public webpage for the following features: - Categories - Classifications - Concepts - Emotion - Entities - Keywords - Metadata - Relations - Semantic roles - Sentiment - Syntax - Summarization (Experimental) 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).
- Parameters
features (Features) – Specific features to analyze the document for.
text (str) – (optional) The plain text to analyze. One of the text, html, or url parameters is required.
html (str) – (optional) The HTML file to analyze. One of the text, html, or url parameters is required.
url (str) – (optional) The webpage to analyze. One of the text, html, or url parameters is required.
clean (bool) – (optional) 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).
xpath (str) – (optional) 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.
fallback_to_raw (bool) – (optional) Whether to use raw HTML content if text cleaning fails.
return_analyzed_text (bool) – (optional) Whether or not to return the analyzed text.
language (str) – (optional) 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).
limit_text_characters (int) – (optional) Sets the maximum number of characters that are processed by the service.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse with dict result representing a AnalysisResults object
-
list_models
(**kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ 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.
- Parameters
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse with dict result representing a ListModelsResults object
-
delete_model
(model_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Delete model.
Deletes a custom model.
-
create_sentiment_model
(language: str, training_data: BinaryIO, *, name: Optional[str] = None, description: Optional[str] = None, model_version: Optional[str] = None, workspace_id: Optional[str] = None, version_description: Optional[str] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Create sentiment model.
(Beta) Creates a custom sentiment model by uploading training data and associated metadata. The model begins the training and deploying process and is ready to use when the status is available.
- Parameters
language (str) – The 2-letter language code of this model.
training_data (BinaryIO) – Training data in CSV format. For more information, see [Sentiment training data requirements](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-custom-sentiment#sentiment-training-data-requirements).
name (str) – (optional) An optional name for the model.
description (str) – (optional) An optional description of the model.
model_version (str) – (optional) An optional version string.
workspace_id (str) – (optional) ID of the Watson Knowledge Studio workspace that deployed this model to Natural Language Understanding.
version_description (str) – (optional) The description of the version.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse with dict result representing a SentimentModel object
-
list_sentiment_models
(**kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ List sentiment models.
(Beta) Returns all custom sentiment models associated with this service instance.
- Parameters
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse with dict result representing a ListSentimentModelsResponse object
-
get_sentiment_model
(model_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Get sentiment model details.
(Beta) Returns the status of the sentiment model with the given model ID.
-
update_sentiment_model
(model_id: str, language: str, training_data: BinaryIO, *, name: Optional[str] = None, description: Optional[str] = None, model_version: Optional[str] = None, workspace_id: Optional[str] = None, version_description: Optional[str] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Update sentiment model.
(Beta) Overwrites the training data associated with this custom sentiment model and retrains the model. The new model replaces the current deployment.
- Parameters
model_id (str) – ID of the model.
language (str) – The 2-letter language code of this model.
training_data (BinaryIO) – Training data in CSV format. For more information, see [Sentiment training data requirements](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-custom-sentiment#sentiment-training-data-requirements).
name (str) – (optional) An optional name for the model.
description (str) – (optional) An optional description of the model.
model_version (str) – (optional) An optional version string.
workspace_id (str) – (optional) ID of the Watson Knowledge Studio workspace that deployed this model to Natural Language Understanding.
version_description (str) – (optional) The description of the version.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse with dict result representing a SentimentModel object
-
delete_sentiment_model
(model_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Delete sentiment model.
(Beta) Un-deploys the custom sentiment model with the given model ID and deletes all associated customer data, including any training data or binary artifacts.
-
create_categories_model
(language: str, training_data: BinaryIO, *, training_data_content_type: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, model_version: Optional[str] = None, workspace_id: Optional[str] = None, version_description: Optional[str] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Create categories model.
(Beta) Creates a custom categories model by uploading training data and associated metadata. The model begins the training and deploying process and is ready to use when the status is available.
- Parameters
language (str) – The 2-letter language code of this model.
training_data (BinaryIO) – Training data in JSON format. For more information, see [Categories training data requirements](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-categories##categories-training-data-requirements).
training_data_content_type (str) – (optional) The content type of training_data.
name (str) – (optional) An optional name for the model.
description (str) – (optional) An optional description of the model.
model_version (str) – (optional) An optional version string.
workspace_id (str) – (optional) ID of the Watson Knowledge Studio workspace that deployed this model to Natural Language Understanding.
version_description (str) – (optional) The description of the version.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse with dict result representing a CategoriesModel object
-
list_categories_models
(**kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ List categories models.
(Beta) Returns all custom categories models associated with this service instance.
- Parameters
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse with dict result representing a CategoriesModelList object
-
get_categories_model
(model_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Get categories model details.
(Beta) Returns the status of the categories model with the given model ID.
-
update_categories_model
(model_id: str, language: str, training_data: BinaryIO, *, training_data_content_type: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, model_version: Optional[str] = None, workspace_id: Optional[str] = None, version_description: Optional[str] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Update categories model.
(Beta) Overwrites the training data associated with this custom categories model and retrains the model. The new model replaces the current deployment.
- Parameters
model_id (str) – ID of the model.
language (str) – The 2-letter language code of this model.
training_data (BinaryIO) – Training data in JSON format. For more information, see [Categories training data requirements](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-categories##categories-training-data-requirements).
training_data_content_type (str) – (optional) The content type of training_data.
name (str) – (optional) An optional name for the model.
description (str) – (optional) An optional description of the model.
model_version (str) – (optional) An optional version string.
workspace_id (str) – (optional) ID of the Watson Knowledge Studio workspace that deployed this model to Natural Language Understanding.
version_description (str) – (optional) The description of the version.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse with dict result representing a CategoriesModel object
-
delete_categories_model
(model_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Delete categories model.
(Beta) Un-deploys the custom categories model with the given model ID and deletes all associated customer data, including any training data or binary artifacts.
-
create_classifications_model
(language: str, training_data: BinaryIO, *, training_data_content_type: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, model_version: Optional[str] = None, workspace_id: Optional[str] = None, version_description: Optional[str] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Create classifications model.
(Beta) Creates a custom classifications model by uploading training data and associated metadata. The model begins the training and deploying process and is ready to use when the status is available.
- Parameters
language (str) – The 2-letter language code of this model.
training_data (BinaryIO) – Training data in JSON format. For more information, see [Classifications training data requirements](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-classifications#classification-training-data-requirements).
training_data_content_type (str) – (optional) The content type of training_data.
name (str) – (optional) An optional name for the model.
description (str) – (optional) An optional description of the model.
model_version (str) – (optional) An optional version string.
workspace_id (str) – (optional) ID of the Watson Knowledge Studio workspace that deployed this model to Natural Language Understanding.
version_description (str) – (optional) The description of the version.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse with dict result representing a ClassificationsModel object
-
list_classifications_models
(**kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ List classifications models.
(Beta) Returns all custom classifications models associated with this service instance.
- Parameters
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse with dict result representing a ListClassificationsModelsResponse object
-
get_classifications_model
(model_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Get classifications model details.
(Beta) Returns the status of the classifications model with the given model ID.
-
update_classifications_model
(model_id: str, language: str, training_data: BinaryIO, *, training_data_content_type: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, model_version: Optional[str] = None, workspace_id: Optional[str] = None, version_description: Optional[str] = None, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Update classifications model.
(Beta) Overwrites the training data associated with this custom classifications model and retrains the model. The new model replaces the current deployment.
- Parameters
model_id (str) – ID of the model.
language (str) – The 2-letter language code of this model.
training_data (BinaryIO) – Training data in JSON format. For more information, see [Classifications training data requirements](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-classifications#classification-training-data-requirements).
training_data_content_type (str) – (optional) The content type of training_data.
name (str) – (optional) An optional name for the model.
description (str) – (optional) An optional description of the model.
model_version (str) – (optional) An optional version string.
workspace_id (str) – (optional) ID of the Watson Knowledge Studio workspace that deployed this model to Natural Language Understanding.
version_description (str) – (optional) The description of the version.
headers (dict) – A dict containing the request headers
- Returns
A DetailedResponse containing the result, headers and HTTP status code.
- Return type
DetailedResponse with dict result representing a ClassificationsModel object
-
delete_classifications_model
(model_id: str, **kwargs) → ibm_cloud_sdk_core.detailed_response.DetailedResponse[source]¶ Delete classifications model.
(Beta) Un-deploys the custom classifications model with the given model ID and deletes all associated customer data, including any training data or binary artifacts.
-
-
class
CreateCategoriesModelEnums
[source]¶ Bases:
object
Enums for create_categories_model parameters.
-
class
UpdateCategoriesModelEnums
[source]¶ Bases:
object
Enums for update_categories_model parameters.
-
class
CreateClassificationsModelEnums
[source]¶ Bases:
object
Enums for create_classifications_model parameters.
-
class
UpdateClassificationsModelEnums
[source]¶ Bases:
object
Enums for update_classifications_model parameters.
-
class
AnalysisResults
(*, language: Optional[str] = None, analyzed_text: Optional[str] = None, retrieved_url: Optional[str] = None, usage: Optional[ibm_watson.natural_language_understanding_v1.AnalysisResultsUsage] = None, concepts: Optional[List[ibm_watson.natural_language_understanding_v1.ConceptsResult]] = None, entities: Optional[List[ibm_watson.natural_language_understanding_v1.EntitiesResult]] = None, keywords: Optional[List[ibm_watson.natural_language_understanding_v1.KeywordsResult]] = None, categories: Optional[List[ibm_watson.natural_language_understanding_v1.CategoriesResult]] = None, classifications: Optional[List[ibm_watson.natural_language_understanding_v1.ClassificationsResult]] = None, emotion: Optional[ibm_watson.natural_language_understanding_v1.EmotionResult] = None, metadata: Optional[ibm_watson.natural_language_understanding_v1.FeaturesResultsMetadata] = None, relations: Optional[List[ibm_watson.natural_language_understanding_v1.RelationsResult]] = None, semantic_roles: Optional[List[ibm_watson.natural_language_understanding_v1.SemanticRolesResult]] = None, sentiment: Optional[ibm_watson.natural_language_understanding_v1.SentimentResult] = None, syntax: Optional[ibm_watson.natural_language_understanding_v1.SyntaxResult] = None)[source]¶ Bases:
object
Results of the analysis, organized by feature.
- Attr str language
(optional) Language used to analyze the text.
- Attr str analyzed_text
(optional) Text that was used in the analysis.
- Attr str retrieved_url
(optional) URL of the webpage that was analyzed.
- Attr AnalysisResultsUsage usage
(optional) API usage information for the request.
- Attr List[ConceptsResult] concepts
(optional) The general concepts referenced or alluded to in the analyzed text.
- Attr List[EntitiesResult] entities
(optional) The entities detected in the analyzed text.
- Attr List[KeywordsResult] keywords
(optional) The keywords from the analyzed text.
- Attr List[CategoriesResult] categories
(optional) The categories that the service assigned to the analyzed text.
- Attr List[ClassificationsResult] classifications
(optional) The classifications assigned to the analyzed text.
- Attr EmotionResult emotion
(optional) The anger, disgust, fear, joy, or sadness conveyed by the content.
- Attr FeaturesResultsMetadata metadata
(optional) Webpage metadata, such as the author and the title of the page.
- Attr List[RelationsResult] relations
(optional) The relationships between entities in the content.
- Attr List[SemanticRolesResult] semantic_roles
(optional) Sentences parsed into subject, action, and object form.
- Attr SentimentResult sentiment
(optional) The sentiment of the content.
- Attr SyntaxResult syntax
(optional) Tokens and sentences returned from syntax analysis.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.AnalysisResults[source]¶ Initialize a AnalysisResults object from a json dictionary.
-
class
AnalysisResultsUsage
(*, features: Optional[int] = None, text_characters: Optional[int] = None, text_units: Optional[int] = None)[source]¶ Bases:
object
API usage information for the request.
- Attr int features
(optional) Number of features used in the API call.
- Attr int text_characters
(optional) Number of text characters processed.
- Attr int text_units
(optional) Number of 10,000-character units processed.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.AnalysisResultsUsage[source]¶ Initialize a AnalysisResultsUsage object from a json dictionary.
-
class
Author
(*, name: Optional[str] = None)[source]¶ Bases:
object
The author of the analyzed content.
- Attr str name
(optional) Name of the author.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.Author[source]¶ Initialize a Author object from a json dictionary.
-
class
CategoriesModel
(language: str, status: str, model_id: str, created: datetime.datetime, *, name: Optional[str] = None, user_metadata: Optional[dict] = None, description: Optional[str] = None, model_version: Optional[str] = None, workspace_id: Optional[str] = None, version_description: Optional[str] = None, features: Optional[List[str]] = None, notices: Optional[List[ibm_watson.natural_language_understanding_v1.Notice]] = None, last_trained: Optional[datetime.datetime] = None, last_deployed: Optional[datetime.datetime] = None)[source]¶ Bases:
object
Categories model.
- Attr str name
(optional) An optional name for the model.
- Attr dict user_metadata
(optional) An optional map of metadata key-value pairs to store with this model.
- Attr str language
The 2-letter language code of this model.
- Attr str description
(optional) An optional description of the model.
- Attr str model_version
(optional) An optional version string.
- Attr str workspace_id
(optional) ID of the Watson Knowledge Studio workspace that deployed this model to Natural Language Understanding.
- Attr str version_description
(optional) The description of the version.
- Attr List[str] features
(optional) The service features that are supported by the custom model.
- Attr str status
When the status is available, the model is ready to use.
- Attr str model_id
Unique model ID.
- Attr datetime created
dateTime indicating when the model was created.
- Attr List[Notice] notices
(optional)
- Attr datetime last_trained
(optional) dateTime of last successful model training.
- Attr datetime last_deployed
(optional) dateTime of last successful model deployment.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.CategoriesModel[source]¶ Initialize a CategoriesModel object from a json dictionary.
-
class
CategoriesModelList
(*, models: Optional[List[ibm_watson.natural_language_understanding_v1.CategoriesModel]] = None)[source]¶ Bases:
object
List of categories models.
- Attr List[CategoriesModel] models
(optional) The categories models.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.CategoriesModelList[source]¶ Initialize a CategoriesModelList object from a json dictionary.
-
class
CategoriesOptions
(*, explanation: Optional[bool] = None, limit: Optional[int] = None, model: Optional[str] = None)[source]¶ Bases:
object
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.
- Attr bool explanation
(optional) Set this to true to return explanations for each categorization. This is available only for English categories..
- Attr int limit
(optional) Maximum number of categories to return.
- Attr str model
(optional) (Beta) Enter a [custom model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) ID to override the standard categories model. This is available only for English categories..
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.CategoriesOptions[source]¶ Initialize a CategoriesOptions object from a json dictionary.
-
class
CategoriesRelevantText
(*, text: Optional[str] = None)[source]¶ Bases:
object
Relevant text that contributed to the categorization.
- Attr str text
(optional) Text from the analyzed source that supports the categorization.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.CategoriesRelevantText[source]¶ Initialize a CategoriesRelevantText object from a json dictionary.
-
class
CategoriesResult
(*, label: Optional[str] = None, score: Optional[float] = None, explanation: Optional[ibm_watson.natural_language_understanding_v1.CategoriesResultExplanation] = None)[source]¶ Bases:
object
A categorization of the analyzed text.
- Attr str label
(optional) 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).
- Attr float score
(optional) Confidence score for the category classification. Higher values indicate greater confidence.
- Attr CategoriesResultExplanation explanation
(optional) Information that helps to explain what contributed to the categories result.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.CategoriesResult[source]¶ Initialize a CategoriesResult object from a json dictionary.
-
class
CategoriesResultExplanation
(*, relevant_text: Optional[List[ibm_watson.natural_language_understanding_v1.CategoriesRelevantText]] = None)[source]¶ Bases:
object
Information that helps to explain what contributed to the categories result.
- Attr List[CategoriesRelevantText] relevant_text
(optional) 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.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.CategoriesResultExplanation[source]¶ Initialize a CategoriesResultExplanation object from a json dictionary.
-
class
ClassificationsModel
(language: str, status: str, model_id: str, created: datetime.datetime, *, name: Optional[str] = None, user_metadata: Optional[dict] = None, description: Optional[str] = None, model_version: Optional[str] = None, workspace_id: Optional[str] = None, version_description: Optional[str] = None, features: Optional[List[str]] = None, notices: Optional[List[ibm_watson.natural_language_understanding_v1.Notice]] = None, last_trained: Optional[datetime.datetime] = None, last_deployed: Optional[datetime.datetime] = None)[source]¶ Bases:
object
Classifications model.
- Attr str name
(optional) An optional name for the model.
- Attr dict user_metadata
(optional) An optional map of metadata key-value pairs to store with this model.
- Attr str language
The 2-letter language code of this model.
- Attr str description
(optional) An optional description of the model.
- Attr str model_version
(optional) An optional version string.
- Attr str workspace_id
(optional) ID of the Watson Knowledge Studio workspace that deployed this model to Natural Language Understanding.
- Attr str version_description
(optional) The description of the version.
- Attr List[str] features
(optional) The service features that are supported by the custom model.
- Attr str status
When the status is available, the model is ready to use.
- Attr str model_id
Unique model ID.
- Attr datetime created
dateTime indicating when the model was created.
- Attr List[Notice] notices
(optional)
- Attr datetime last_trained
(optional) dateTime of last successful model training.
- Attr datetime last_deployed
(optional) dateTime of last successful model deployment.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.ClassificationsModel[source]¶ Initialize a ClassificationsModel object from a json dictionary.
-
class
ClassificationsModelList
(*, models: Optional[List[ibm_watson.natural_language_understanding_v1.ClassificationsModel]] = None)[source]¶ Bases:
object
List of classifications models.
- Attr List[ClassificationsModel] models
(optional) The classifications models.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.ClassificationsModelList[source]¶ Initialize a ClassificationsModelList object from a json dictionary.
-
class
ClassificationsOptions
(*, model: Optional[str] = None)[source]¶ Bases:
object
Returns text classifications for the content. Supported languages: English only.
- Attr str model
(optional) (Beta) Enter a [custom model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) ID of the classification model to be used.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.ClassificationsOptions[source]¶ Initialize a ClassificationsOptions object from a json dictionary.
-
class
ClassificationsResult
(*, class_name: Optional[str] = None, confidence: Optional[float] = None)[source]¶ Bases:
object
A classification of the analyzed text.
- Attr str class_name
(optional) Classification assigned to the text.
- Attr float confidence
(optional) Confidence score for the classification. Higher values indicate greater confidence.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.ClassificationsResult[source]¶ Initialize a ClassificationsResult object from a json dictionary.
-
class
ConceptsOptions
(*, limit: Optional[int] = None)[source]¶ Bases:
object
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.
- Attr int limit
(optional) Maximum number of concepts to return.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.ConceptsOptions[source]¶ Initialize a ConceptsOptions object from a json dictionary.
-
class
ConceptsResult
(*, text: Optional[str] = None, relevance: Optional[float] = None, dbpedia_resource: Optional[str] = None)[source]¶ Bases:
object
The general concepts referenced or alluded to in the analyzed text.
- Attr str text
(optional) Name of the concept.
- Attr float relevance
(optional) Relevance score between 0 and 1. Higher scores indicate greater relevance.
- Attr str dbpedia_resource
(optional) Link to the corresponding DBpedia resource.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.ConceptsResult[source]¶ Initialize a ConceptsResult object from a json dictionary.
-
class
DeleteModelResults
(*, deleted: Optional[str] = None)[source]¶ Bases:
object
Delete model results.
- Attr str deleted
(optional) model_id of the deleted model.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.DeleteModelResults[source]¶ Initialize a DeleteModelResults object from a json dictionary.
-
class
DisambiguationResult
(*, name: Optional[str] = None, dbpedia_resource: Optional[str] = None, subtype: Optional[List[str]] = None)[source]¶ Bases:
object
Disambiguation information for the entity.
- Attr str name
(optional) Common entity name.
- Attr str dbpedia_resource
(optional) Link to the corresponding DBpedia resource.
- Attr List[str] subtype
(optional) Entity subtype information.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.DisambiguationResult[source]¶ Initialize a DisambiguationResult object from a json dictionary.
-
class
DocumentEmotionResults
(*, emotion: Optional[ibm_watson.natural_language_understanding_v1.EmotionScores] = None)[source]¶ Bases:
object
Emotion results for the document as a whole.
- Attr EmotionScores emotion
(optional) Emotion results for the document as a whole.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.DocumentEmotionResults[source]¶ Initialize a DocumentEmotionResults object from a json dictionary.
-
class
DocumentSentimentResults
(*, label: Optional[str] = None, score: Optional[float] = None)[source]¶ Bases:
object
DocumentSentimentResults.
- Attr str label
(optional) Indicates whether the sentiment is positive, neutral, or negative.
- Attr float score
(optional) Sentiment score from -1 (negative) to 1 (positive).
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.DocumentSentimentResults[source]¶ Initialize a DocumentSentimentResults object from a json dictionary.
-
class
EmotionOptions
(*, document: Optional[bool] = None, targets: Optional[List[str]] = None)[source]¶ Bases:
object
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.
- Attr bool document
(optional) Set this to false to hide document-level emotion results.
- Attr List[str] targets
(optional) Emotion results will be returned for each target string that is found in the document.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.EmotionOptions[source]¶ Initialize a EmotionOptions object from a json dictionary.
-
class
EmotionResult
(*, document: Optional[ibm_watson.natural_language_understanding_v1.DocumentEmotionResults] = None, targets: Optional[List[ibm_watson.natural_language_understanding_v1.TargetedEmotionResults]] = None)[source]¶ Bases:
object
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.
- Attr DocumentEmotionResults document
(optional) Emotion results for the document as a whole.
- Attr List[TargetedEmotionResults] targets
(optional) Emotion results for specified targets.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.EmotionResult[source]¶ Initialize a EmotionResult object from a json dictionary.
-
class
EmotionScores
(*, anger: Optional[float] = None, disgust: Optional[float] = None, fear: Optional[float] = None, joy: Optional[float] = None, sadness: Optional[float] = None)[source]¶ Bases:
object
EmotionScores.
- Attr float anger
(optional) Anger score from 0 to 1. A higher score means that the text is more likely to convey anger.
- Attr float disgust
(optional) Disgust score from 0 to 1. A higher score means that the text is more likely to convey disgust.
- Attr float fear
(optional) Fear score from 0 to 1. A higher score means that the text is more likely to convey fear.
- Attr float joy
(optional) Joy score from 0 to 1. A higher score means that the text is more likely to convey joy.
- Attr float sadness
(optional) Sadness score from 0 to 1. A higher score means that the text is more likely to convey sadness.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.EmotionScores[source]¶ Initialize a EmotionScores object from a json dictionary.
-
class
EntitiesOptions
(*, limit: Optional[int] = None, mentions: Optional[bool] = None, model: Optional[str] = None, sentiment: Optional[bool] = None, emotion: Optional[bool] = None)[source]¶ Bases:
object
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.
- Attr int limit
(optional) Maximum number of entities to return.
- Attr bool mentions
(optional) Set this to true to return locations of entity mentions.
- Attr str model
(optional) 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.
- Attr bool sentiment
(optional) Set this to true to return sentiment information for detected entities.
- Attr bool emotion
(optional) Set this to true to analyze emotion for detected keywords.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.EntitiesOptions[source]¶ Initialize a EntitiesOptions object from a json dictionary.
-
class
EntitiesResult
(*, type: Optional[str] = None, text: Optional[str] = None, relevance: Optional[float] = None, confidence: Optional[float] = None, mentions: Optional[List[ibm_watson.natural_language_understanding_v1.EntityMention]] = None, count: Optional[int] = None, emotion: Optional[ibm_watson.natural_language_understanding_v1.EmotionScores] = None, sentiment: Optional[ibm_watson.natural_language_understanding_v1.FeatureSentimentResults] = None, disambiguation: Optional[ibm_watson.natural_language_understanding_v1.DisambiguationResult] = None)[source]¶ Bases:
object
The important people, places, geopolitical entities and other types of entities in your content.
- Attr str type
(optional) Entity type.
- Attr str text
(optional) The name of the entity.
- Attr float relevance
(optional) Relevance score from 0 to 1. Higher values indicate greater relevance.
- Attr float confidence
(optional) 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.
- Attr List[EntityMention] mentions
(optional) Entity mentions and locations.
- Attr int count
(optional) How many times the entity was mentioned in the text.
- Attr EmotionScores emotion
(optional) Emotion analysis results for the entity, enabled with the emotion option.
- Attr FeatureSentimentResults sentiment
(optional) Sentiment analysis results for the entity, enabled with the sentiment option.
- Attr DisambiguationResult disambiguation
(optional) Disambiguation information for the entity.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.EntitiesResult[source]¶ Initialize a EntitiesResult object from a json dictionary.
-
class
EntityMention
(*, text: Optional[str] = None, location: Optional[List[int]] = None, confidence: Optional[float] = None)[source]¶ Bases:
object
EntityMention.
- Attr str text
(optional) Entity mention text.
- Attr List[int] location
(optional) Character offsets indicating the beginning and end of the mention in the analyzed text.
- Attr float confidence
(optional) 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.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.EntityMention[source]¶ Initialize a EntityMention object from a json dictionary.
-
class
FeatureSentimentResults
(*, score: Optional[float] = None)[source]¶ Bases:
object
FeatureSentimentResults.
- Attr float score
(optional) Sentiment score from -1 (negative) to 1 (positive).
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.FeatureSentimentResults[source]¶ Initialize a FeatureSentimentResults object from a json dictionary.
-
class
Features
(*, classifications: Optional[ibm_watson.natural_language_understanding_v1.ClassificationsOptions] = None, concepts: Optional[ibm_watson.natural_language_understanding_v1.ConceptsOptions] = None, emotion: Optional[ibm_watson.natural_language_understanding_v1.EmotionOptions] = None, entities: Optional[ibm_watson.natural_language_understanding_v1.EntitiesOptions] = None, keywords: Optional[ibm_watson.natural_language_understanding_v1.KeywordsOptions] = None, metadata: Optional[ibm_watson.natural_language_understanding_v1.MetadataOptions] = None, relations: Optional[ibm_watson.natural_language_understanding_v1.RelationsOptions] = None, semantic_roles: Optional[ibm_watson.natural_language_understanding_v1.SemanticRolesOptions] = None, sentiment: Optional[ibm_watson.natural_language_understanding_v1.SentimentOptions] = None, summarization: Optional[ibm_watson.natural_language_understanding_v1.SummarizationOptions] = None, categories: Optional[ibm_watson.natural_language_understanding_v1.CategoriesOptions] = None, syntax: Optional[ibm_watson.natural_language_understanding_v1.SyntaxOptions] = None)[source]¶ Bases:
object
Analysis features and options.
- Attr ClassificationsOptions classifications
(optional) Returns text classifications for the content. Supported languages: English only.
- Attr ConceptsOptions concepts
(optional) 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.
- Attr EmotionOptions emotion
(optional) 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.
- Attr EntitiesOptions entities
(optional) 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.
- Attr KeywordsOptions keywords
(optional) Returns important keywords in the content. Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish.
- Attr MetadataOptions metadata
(optional) 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.
- Attr RelationsOptions relations
(optional) 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.
- Attr SemanticRolesOptions semantic_roles
(optional) Parses sentences into subject, action, and object form. Supported languages: English, German, Japanese, Korean, Spanish.
- Attr SentimentOptions sentiment
(optional) 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.
- Attr SummarizationOptions summarization
(optional) (Experimental) Returns a summary of content. Supported languages: English only.
- Attr CategoriesOptions categories
(optional) 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.
- Attr SyntaxOptions syntax
(optional) Returns tokens and sentences from the input text.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.Features[source]¶ Initialize a Features object from a json dictionary.
-
class
FeaturesResultsMetadata
(*, authors: Optional[List[ibm_watson.natural_language_understanding_v1.Author]] = None, publication_date: Optional[str] = None, title: Optional[str] = None, image: Optional[str] = None, feeds: Optional[List[ibm_watson.natural_language_understanding_v1.Feed]] = None)[source]¶ Bases:
object
Webpage metadata, such as the author and the title of the page.
- Attr List[Author] authors
(optional) The authors of the document.
- Attr str publication_date
(optional) The publication date in the format ISO 8601.
- Attr str title
(optional) The title of the document.
- Attr str image
(optional) URL of a prominent image on the webpage.
- Attr List[Feed] feeds
(optional) RSS/ATOM feeds found on the webpage.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.FeaturesResultsMetadata[source]¶ Initialize a FeaturesResultsMetadata object from a json dictionary.
-
class
Feed
(*, link: Optional[str] = None)[source]¶ Bases:
object
RSS or ATOM feed found on the webpage.
- Attr str link
(optional) URL of the RSS or ATOM feed.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.Feed[source]¶ Initialize a Feed object from a json dictionary.
-
class
KeywordsOptions
(*, limit: Optional[int] = None, sentiment: Optional[bool] = None, emotion: Optional[bool] = None)[source]¶ Bases:
object
Returns important keywords in the content. Supported languages: English, French, German, Italian, Japanese, Korean, Portuguese, Russian, Spanish, Swedish.
- Attr int limit
(optional) Maximum number of keywords to return.
- Attr bool sentiment
(optional) Set this to true to return sentiment information for detected keywords.
- Attr bool emotion
(optional) Set this to true to analyze emotion for detected keywords.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.KeywordsOptions[source]¶ Initialize a KeywordsOptions object from a json dictionary.
-
class
KeywordsResult
(*, count: Optional[int] = None, relevance: Optional[float] = None, text: Optional[str] = None, emotion: Optional[ibm_watson.natural_language_understanding_v1.EmotionScores] = None, sentiment: Optional[ibm_watson.natural_language_understanding_v1.FeatureSentimentResults] = None)[source]¶ Bases:
object
The important keywords in the content, organized by relevance.
- Attr int count
(optional) Number of times the keyword appears in the analyzed text.
- Attr float relevance
(optional) Relevance score from 0 to 1. Higher values indicate greater relevance.
- Attr str text
(optional) The keyword text.
- Attr EmotionScores emotion
(optional) Emotion analysis results for the keyword, enabled with the emotion option.
- Attr FeatureSentimentResults sentiment
(optional) Sentiment analysis results for the keyword, enabled with the sentiment option.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.KeywordsResult[source]¶ Initialize a KeywordsResult object from a json dictionary.
-
class
ListClassificationsModelsResponse
(*, models: Optional[List[ibm_watson.natural_language_understanding_v1.ClassificationsModelList]] = None)[source]¶ Bases:
object
ListClassificationsModelsResponse.
- Attr List[ClassificationsModelList] models
(optional)
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.ListClassificationsModelsResponse[source]¶ Initialize a ListClassificationsModelsResponse object from a json dictionary.
-
class
ListModelsResults
(*, models: Optional[List[ibm_watson.natural_language_understanding_v1.Model]] = None)[source]¶ Bases:
object
Custom models that are available for entities and relations.
- Attr List[Model] models
(optional) An array of available models.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.ListModelsResults[source]¶ Initialize a ListModelsResults object from a json dictionary.
-
class
ListSentimentModelsResponse
(*, models: Optional[List[ibm_watson.natural_language_understanding_v1.SentimentModel]] = None)[source]¶ Bases:
object
ListSentimentModelsResponse.
- Attr List[SentimentModel] models
(optional)
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.ListSentimentModelsResponse[source]¶ Initialize a ListSentimentModelsResponse object from a json dictionary.
-
class
MetadataOptions
[source]¶ Bases:
object
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.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.MetadataOptions[source]¶ Initialize a MetadataOptions object from a json dictionary.
-
classmethod
-
class
Model
(*, status: Optional[str] = None, model_id: Optional[str] = None, language: Optional[str] = None, description: Optional[str] = None, workspace_id: Optional[str] = None, model_version: Optional[str] = None, version: Optional[str] = None, version_description: Optional[str] = None, created: Optional[datetime.datetime] = None)[source]¶ Bases:
object
Model.
- Attr str status
(optional) When the status is available, the model is ready to use.
- Attr str model_id
(optional) Unique model ID.
- Attr str language
(optional) ISO 639-1 code that indicates the language of the model.
- Attr str description
(optional) Model description.
- Attr str workspace_id
(optional) ID of the Watson Knowledge Studio workspace that deployed this model to Natural Language Understanding.
- Attr str model_version
(optional) The model version, if it was manually provided in Watson Knowledge Studio.
- Attr str version
(optional) Deprecated — use model_version.
- Attr str version_description
(optional) The description of the version, if it was manually provided in Watson Knowledge Studio.
- Attr datetime created
(optional) A dateTime indicating when the model was created.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.Model[source]¶ Initialize a Model object from a json dictionary.
-
class
Notice
(*, message: Optional[str] = None)[source]¶ Bases:
object
A list of messages describing model training issues when model status is error.
- Attr str message
(optional) Describes deficiencies or inconsistencies in training data.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.Notice[source]¶ Initialize a Notice object from a json dictionary.
-
class
RelationArgument
(*, entities: Optional[List[ibm_watson.natural_language_understanding_v1.RelationEntity]] = None, location: Optional[List[int]] = None, text: Optional[str] = None)[source]¶ Bases:
object
RelationArgument.
- Attr List[RelationEntity] entities
(optional) An array of extracted entities.
- Attr List[int] location
(optional) Character offsets indicating the beginning and end of the mention in the analyzed text.
- Attr str text
(optional) Text that corresponds to the argument.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.RelationArgument[source]¶ Initialize a RelationArgument object from a json dictionary.
-
class
RelationEntity
(*, text: Optional[str] = None, type: Optional[str] = None)[source]¶ Bases:
object
An entity that corresponds with an argument in a relation.
- Attr str text
(optional) Text that corresponds to the entity.
- Attr str type
(optional) Entity type.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.RelationEntity[source]¶ Initialize a RelationEntity object from a json dictionary.
-
class
RelationsOptions
(*, model: Optional[str] = None)[source]¶ Bases:
object
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.
- Attr str model
(optional) Enter a [custom model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) ID to override the default model.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.RelationsOptions[source]¶ Initialize a RelationsOptions object from a json dictionary.
-
class
RelationsResult
(*, score: Optional[float] = None, sentence: Optional[str] = None, type: Optional[str] = None, arguments: Optional[List[ibm_watson.natural_language_understanding_v1.RelationArgument]] = None)[source]¶ Bases:
object
The relations between entities found in the content.
- Attr float score
(optional) Confidence score for the relation. Higher values indicate greater confidence.
- Attr str sentence
(optional) The sentence that contains the relation.
- Attr str type
(optional) The type of the relation.
- Attr List[RelationArgument] arguments
(optional) Entity mentions that are involved in the relation.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.RelationsResult[source]¶ Initialize a RelationsResult object from a json dictionary.
-
class
SemanticRolesEntity
(*, type: Optional[str] = None, text: Optional[str] = None)[source]¶ Bases:
object
SemanticRolesEntity.
- Attr str type
(optional) Entity type.
- Attr str text
(optional) The entity text.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SemanticRolesEntity[source]¶ Initialize a SemanticRolesEntity object from a json dictionary.
-
class
SemanticRolesKeyword
(*, text: Optional[str] = None)[source]¶ Bases:
object
SemanticRolesKeyword.
- Attr str text
(optional) The keyword text.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SemanticRolesKeyword[source]¶ Initialize a SemanticRolesKeyword object from a json dictionary.
-
class
SemanticRolesOptions
(*, limit: Optional[int] = None, keywords: Optional[bool] = None, entities: Optional[bool] = None)[source]¶ Bases:
object
Parses sentences into subject, action, and object form. Supported languages: English, German, Japanese, Korean, Spanish.
- Attr int limit
(optional) Maximum number of semantic_roles results to return.
- Attr bool keywords
(optional) Set this to true to return keyword information for subjects and objects.
- Attr bool entities
(optional) Set this to true to return entity information for subjects and objects.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SemanticRolesOptions[source]¶ Initialize a SemanticRolesOptions object from a json dictionary.
-
class
SemanticRolesResult
(*, sentence: Optional[str] = None, subject: Optional[ibm_watson.natural_language_understanding_v1.SemanticRolesResultSubject] = None, action: Optional[ibm_watson.natural_language_understanding_v1.SemanticRolesResultAction] = None, object: Optional[ibm_watson.natural_language_understanding_v1.SemanticRolesResultObject] = None)[source]¶ Bases:
object
The object containing the actions and the objects the actions act upon.
- Attr str sentence
(optional) Sentence from the source that contains the subject, action, and object.
- Attr SemanticRolesResultSubject subject
(optional) The extracted subject from the sentence.
- Attr SemanticRolesResultAction action
(optional) The extracted action from the sentence.
- Attr SemanticRolesResultObject object
(optional) The extracted object from the sentence.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SemanticRolesResult[source]¶ Initialize a SemanticRolesResult object from a json dictionary.
-
class
SemanticRolesResultAction
(*, text: Optional[str] = None, normalized: Optional[str] = None, verb: Optional[ibm_watson.natural_language_understanding_v1.SemanticRolesVerb] = None)[source]¶ Bases:
object
The extracted action from the sentence.
- Attr str text
(optional) Analyzed text that corresponds to the action.
- Attr str normalized
(optional) normalized version of the action.
- Attr SemanticRolesVerb verb
(optional)
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SemanticRolesResultAction[source]¶ Initialize a SemanticRolesResultAction object from a json dictionary.
-
class
SemanticRolesResultObject
(*, text: Optional[str] = None, keywords: Optional[List[ibm_watson.natural_language_understanding_v1.SemanticRolesKeyword]] = None)[source]¶ Bases:
object
The extracted object from the sentence.
- Attr str text
(optional) Object text.
- Attr List[SemanticRolesKeyword] keywords
(optional) An array of extracted keywords.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SemanticRolesResultObject[source]¶ Initialize a SemanticRolesResultObject object from a json dictionary.
-
class
SemanticRolesResultSubject
(*, text: Optional[str] = None, entities: Optional[List[ibm_watson.natural_language_understanding_v1.SemanticRolesEntity]] = None, keywords: Optional[List[ibm_watson.natural_language_understanding_v1.SemanticRolesKeyword]] = None)[source]¶ Bases:
object
The extracted subject from the sentence.
- Attr str text
(optional) Text that corresponds to the subject role.
- Attr List[SemanticRolesEntity] entities
(optional) An array of extracted entities.
- Attr List[SemanticRolesKeyword] keywords
(optional) An array of extracted keywords.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SemanticRolesResultSubject[source]¶ Initialize a SemanticRolesResultSubject object from a json dictionary.
-
class
SemanticRolesVerb
(*, text: Optional[str] = None, tense: Optional[str] = None)[source]¶ Bases:
object
SemanticRolesVerb.
- Attr str text
(optional) The keyword text.
- Attr str tense
(optional) Verb tense.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SemanticRolesVerb[source]¶ Initialize a SemanticRolesVerb object from a json dictionary.
-
class
SentenceResult
(*, text: Optional[str] = None, location: Optional[List[int]] = None)[source]¶ Bases:
object
SentenceResult.
- Attr str text
(optional) The sentence.
- Attr List[int] location
(optional) Character offsets indicating the beginning and end of the sentence in the analyzed text.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SentenceResult[source]¶ Initialize a SentenceResult object from a json dictionary.
-
class
SentimentModel
(*, features: Optional[List[str]] = None, status: Optional[str] = None, model_id: Optional[str] = None, created: Optional[datetime.datetime] = None, last_trained: Optional[datetime.datetime] = None, last_deployed: Optional[datetime.datetime] = None, name: Optional[str] = None, user_metadata: Optional[dict] = None, language: Optional[str] = None, description: Optional[str] = None, model_version: Optional[str] = None, notices: Optional[List[ibm_watson.natural_language_understanding_v1.Notice]] = None, workspace_id: Optional[str] = None, version_description: Optional[str] = None)[source]¶ Bases:
object
SentimentModel.
- Attr List[str] features
(optional) The service features that are supported by the custom model.
- Attr str status
(optional) When the status is available, the model is ready to use.
- Attr str model_id
(optional) Unique model ID.
- Attr datetime created
(optional) dateTime indicating when the model was created.
- Attr datetime last_trained
(optional) dateTime of last successful model training.
- Attr datetime last_deployed
(optional) dateTime of last successful model deployment.
- Attr str name
(optional) A name for the model.
- Attr dict user_metadata
(optional) An optional map of metadata key-value pairs to store with this model.
- Attr str language
(optional) The 2-letter language code of this model.
- Attr str description
(optional) An optional description of the model.
- Attr str model_version
(optional) An optional version string.
- Attr List[Notice] notices
(optional)
- Attr str workspace_id
(optional) ID of the Watson Knowledge Studio workspace that deployed this model to Natural Language Understanding.
- Attr str version_description
(optional) The description of the version.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SentimentModel[source]¶ Initialize a SentimentModel object from a json dictionary.
-
class
SentimentOptions
(*, document: Optional[bool] = None, targets: Optional[List[str]] = None, model: Optional[str] = None)[source]¶ Bases:
object
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.
- Attr bool document
(optional) Set this to false to hide document-level sentiment results.
- Attr List[str] targets
(optional) Sentiment results will be returned for each target string that is found in the document.
- Attr str model
(optional) (Beta) Enter a [custom model](https://cloud.ibm.com/docs/natural-language-understanding?topic=natural-language-understanding-customizing) ID to override the standard sentiment model for all sentiment analysis operations in the request, including targeted sentiment for entities and keywords.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SentimentOptions[source]¶ Initialize a SentimentOptions object from a json dictionary.
-
class
SentimentResult
(*, document: Optional[ibm_watson.natural_language_understanding_v1.DocumentSentimentResults] = None, targets: Optional[List[ibm_watson.natural_language_understanding_v1.TargetedSentimentResults]] = None)[source]¶ Bases:
object
The sentiment of the content.
- Attr DocumentSentimentResults document
(optional) The document level sentiment.
- Attr List[TargetedSentimentResults] targets
(optional) The targeted sentiment to analyze.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SentimentResult[source]¶ Initialize a SentimentResult object from a json dictionary.
-
class
SummarizationOptions
(*, limit: Optional[int] = None)[source]¶ Bases:
object
(Experimental) Returns a summary of content. Supported languages: English only.
- Attr int limit
(optional) Maximum number of summary sentences to return.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SummarizationOptions[source]¶ Initialize a SummarizationOptions object from a json dictionary.
-
class
SyntaxOptions
(*, tokens: Optional[ibm_watson.natural_language_understanding_v1.SyntaxOptionsTokens] = None, sentences: Optional[bool] = None)[source]¶ Bases:
object
Returns tokens and sentences from the input text.
- Attr SyntaxOptionsTokens tokens
(optional) Tokenization options.
- Attr bool sentences
(optional) Set this to true to return sentence information.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SyntaxOptions[source]¶ Initialize a SyntaxOptions object from a json dictionary.
-
class
SyntaxOptionsTokens
(*, lemma: Optional[bool] = None, part_of_speech: Optional[bool] = None)[source]¶ Bases:
object
Tokenization options.
- Attr bool lemma
(optional) Set this to true to return the lemma for each token.
- Attr bool part_of_speech
(optional) Set this to true to return the part of speech for each token.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SyntaxOptionsTokens[source]¶ Initialize a SyntaxOptionsTokens object from a json dictionary.
-
class
SyntaxResult
(*, tokens: Optional[List[ibm_watson.natural_language_understanding_v1.TokenResult]] = None, sentences: Optional[List[ibm_watson.natural_language_understanding_v1.SentenceResult]] = None)[source]¶ Bases:
object
Tokens and sentences returned from syntax analysis.
- Attr List[TokenResult] tokens
(optional)
- Attr List[SentenceResult] sentences
(optional)
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.SyntaxResult[source]¶ Initialize a SyntaxResult object from a json dictionary.
-
class
TargetedEmotionResults
(*, text: Optional[str] = None, emotion: Optional[ibm_watson.natural_language_understanding_v1.EmotionScores] = None)[source]¶ Bases:
object
Emotion results for a specified target.
- Attr str text
(optional) Targeted text.
- Attr EmotionScores emotion
(optional) The emotion results for the target.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.TargetedEmotionResults[source]¶ Initialize a TargetedEmotionResults object from a json dictionary.
-
class
TargetedSentimentResults
(*, text: Optional[str] = None, score: Optional[float] = None)[source]¶ Bases:
object
TargetedSentimentResults.
- Attr str text
(optional) Targeted text.
- Attr float score
(optional) Sentiment score from -1 (negative) to 1 (positive).
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.TargetedSentimentResults[source]¶ Initialize a TargetedSentimentResults object from a json dictionary.
-
class
TokenResult
(*, text: Optional[str] = None, part_of_speech: Optional[str] = None, location: Optional[List[int]] = None, lemma: Optional[str] = None)[source]¶ Bases:
object
TokenResult.
- Attr str text
(optional) The token as it appears in the analyzed text.
- Attr str part_of_speech
(optional) The part of speech of the token. For more information about the values, see [Universal Dependencies POS tags](https://universaldependencies.org/u/pos/).
- Attr List[int] location
(optional) Character offsets indicating the beginning and end of the token in the analyzed text.
- Attr str lemma
(optional) The [lemma](https://wikipedia.org/wiki/Lemma_%28morphology%29) of the token.
-
classmethod
from_dict
(_dict: Dict) → ibm_watson.natural_language_understanding_v1.TokenResult[source]¶ Initialize a TokenResult object from a json dictionary.
-
class
PartOfSpeechEnum
(value)[source]¶ -
The part of speech of the token. For more information about the values, see [Universal Dependencies POS tags](https://universaldependencies.org/u/pos/).
-
ADJ
= 'ADJ'¶
-
ADP
= 'ADP'¶
-
ADV
= 'ADV'¶
-
AUX
= 'AUX'¶
-
CCONJ
= 'CCONJ'¶
-
DET
= 'DET'¶
-
INTJ
= 'INTJ'¶
-
NOUN
= 'NOUN'¶
-
NUM
= 'NUM'¶
-
PART
= 'PART'¶
-
PRON
= 'PRON'¶
-
PROPN
= 'PROPN'¶
-
PUNCT
= 'PUNCT'¶
-
SCONJ
= 'SCONJ'¶
-
SYM
= 'SYM'¶
-
VERB
= 'VERB'¶
-
X
= 'X'¶
-