azure.ai.textanalytics package¶
-
class
azure.ai.textanalytics.
AnalyzeSentimentResult
(**kwargs)[source]¶ AnalyzeSentimentResult is a result object which contains the overall predicted sentiment and confidence scores for your document and a per-sentence sentiment prediction with scores.
- Variables
id (str) – Unique, non-empty document identifier that matches the document id that was passed in with the request. If not specified in the request, an id is assigned for the document.
sentiment (str) – Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). Possible values include: ‘positive’, ‘neutral’, ‘negative’, ‘mixed’
warnings (list[TextAnalyticsWarning]) – Warnings encountered while processing document. Results will still be returned if there are warnings, but they may not be fully accurate.
statistics (TextDocumentStatistics) – If show_stats=true was specified in the request this field will contain information about the document payload.
confidence_scores (SentimentConfidenceScores) – Document level sentiment confidence scores between 0 and 1 for each sentiment label.
sentences (list[SentenceSentiment]) – Sentence level sentiment analysis.
is_error (bool) – Boolean check for error item when iterating over list of results. Always False for an instance of a AnalyzeSentimentResult.
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
CategorizedEntity
(**kwargs)[source]¶ CategorizedEntity contains information about a particular entity found in text.
- Variables
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
DetectLanguageInput
(**kwargs)[source]¶ The input document to be analyzed for detecting language.
- Variables
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionaly use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
class
azure.ai.textanalytics.
DetectLanguageResult
(**kwargs)[source]¶ DetectLanguageResult is a result object which contains the detected language of a particular document.
- Variables
id (str) – Unique, non-empty document identifier that matches the document id that was passed in with the request. If not specified in the request, an id is assigned for the document.
primary_language (DetectedLanguage) – The primary language detected in the document.
warnings (list[TextAnalyticsWarning]) – Warnings encountered while processing document. Results will still be returned if there are warnings, but they may not be fully accurate.
statistics (TextDocumentStatistics) – If show_stats=true was specified in the request this field will contain information about the document payload.
is_error (bool) – Boolean check for error item when iterating over list of results. Always False for an instance of a DetectLanguageResult.
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
DetectedLanguage
(**kwargs)[source]¶ DetectedLanguage contains the predicted language found in text, its confidence score, and ISO 639-1 representation.
- Variables
name (str) – Long name of a detected language (e.g. English, French).
iso6391_name (str) – A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr).
confidence_score (float) – A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true.
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
DocumentError
(**kwargs)[source]¶ DocumentError is an error object which represents an error on the individual document.
- Variables
id (str) – Unique, non-empty document identifier that matches the document id that was passed in with the request. If not specified in the request, an id is assigned for the document.
error (TextAnalyticsError) – The document error.
is_error (bool) – Boolean check for error item when iterating over list of results. Always True for an instance of a DocumentError.
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
ExtractKeyPhrasesResult
(**kwargs)[source]¶ ExtractKeyPhrasesResult is a result object which contains the key phrases found in a particular document.
- Variables
id (str) – Unique, non-empty document identifier that matches the document id that was passed in with the request. If not specified in the request, an id is assigned for the document.
key_phrases (list[str]) – A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document.
warnings (list[TextAnalyticsWarning]) – Warnings encountered while processing document. Results will still be returned if there are warnings, but they may not be fully accurate.
statistics (TextDocumentStatistics) – If show_stats=true was specified in the request this field will contain information about the document payload.
is_error (bool) – Boolean check for error item when iterating over list of results. Always False for an instance of a ExtractKeyPhrasesResult.
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
LinkedEntity
(**kwargs)[source]¶ LinkedEntity contains a link to the well-known recognized entity in text. The link comes from a data source like Wikipedia or Bing. It additionally includes all of the matches of this entity found in the document.
- Variables
name (str) – Entity Linking formal name.
matches (list[LinkedEntityMatch]) – List of instances this entity appears in the text.
language (str) – Language used in the data source.
data_source_entity_id (str) – Unique identifier of the recognized entity from the data source.
url (str) – URL to the entity’s page from the data source.
data_source (str) – Data source used to extract entity linking, such as Wiki/Bing etc.
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
LinkedEntityMatch
(**kwargs)[source]¶ A match for the linked entity found in text. Provides the confidence score of the prediction and where the entity was found in the text.
- Variables
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
RecognizeEntitiesResult
(**kwargs)[source]¶ RecognizeEntitiesResult is a result object which contains the recognized entities from a particular document.
- Variables
id (str) – Unique, non-empty document identifier that matches the document id that was passed in with the request. If not specified in the request, an id is assigned for the document.
entities (list[CategorizedEntity]) – Recognized entities in the document.
warnings (list[TextAnalyticsWarning]) – Warnings encountered while processing document. Results will still be returned if there are warnings, but they may not be fully accurate.
statistics (TextDocumentStatistics) – If show_stats=true was specified in the request this field will contain information about the document payload.
is_error (bool) – Boolean check for error item when iterating over list of results. Always False for an instance of a RecognizeEntitiesResult.
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
RecognizeLinkedEntitiesResult
(**kwargs)[source]¶ RecognizeLinkedEntitiesResult is a result object which contains links to a well-known knowledge base, like for example, Wikipedia or Bing.
- Variables
id (str) – Unique, non-empty document identifier that matches the document id that was passed in with the request. If not specified in the request, an id is assigned for the document.
entities (list[LinkedEntity]) – Recognized well-known entities in the document.
warnings (list[TextAnalyticsWarning]) – Warnings encountered while processing document. Results will still be returned if there are warnings, but they may not be fully accurate.
statistics (TextDocumentStatistics) – If show_stats=true was specified in the request this field will contain information about the document payload.
is_error (bool) – Boolean check for error item when iterating over list of results. Always False for an instance of a RecognizeLinkedEntitiesResult.
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
SentenceSentiment
(**kwargs)[source]¶ SentenceSentiment contains the predicted sentiment and confidence scores for each individual sentence in the document.
- Variables
text (str) – The sentence text.
sentiment (str) – The predicted Sentiment for the sentence. Possible values include: ‘positive’, ‘neutral’, ‘negative’
confidence_scores (SentimentConfidenceScores) – The sentiment confidence score between 0 and 1 for the sentence for all labels.
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
SentimentConfidenceScores
(**kwargs)[source]¶ The confidence scores (Softmax scores) between 0 and 1. Higher values indicate higher confidence.
- Variables
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
TextAnalyticsClient
(endpoint: str, credential: Union[AzureKeyCredential, TokenCredential], **kwargs: Any)[source]¶ The Text Analytics API is a suite of text analytics web services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction, and language detection. No training data is needed to use this API - just bring your text data. This API uses advanced natural language processing techniques to deliver best in class predictions.
Further documentation can be found in https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview
- Parameters
endpoint (str) – Supported Cognitive Services or Text Analytics resource endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).
credential (
AzureKeyCredential
orTokenCredential
) – Credentials needed for the client to connect to Azure. This can be the an instance of AzureKeyCredential if using a cognitive services/text analytics API key or a token credential fromazure.identity
.
- Keyword Arguments
Example:
from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient endpoint = os.environ["AZURE_TEXT_ANALYTICS_ENDPOINT"] key = os.environ["AZURE_TEXT_ANALYTICS_KEY"] text_analytics_client = TextAnalyticsClient(endpoint, AzureKeyCredential(key))
from azure.ai.textanalytics import TextAnalyticsClient from azure.identity import DefaultAzureCredential endpoint = os.environ["AZURE_TEXT_ANALYTICS_ENDPOINT"] credential = DefaultAzureCredential() text_analytics_client = TextAnalyticsClient(endpoint, credential=credential)
-
analyze_sentiment
(**kwargs: Any) → List[Union[AnalyzeSentimentResult, DocumentError]][source]¶ Analyze sentiment for a batch of documents.
Returns a sentiment prediction, as well as sentiment scores for each sentiment class (Positive, Negative, and Neutral) for the document and each sentence within it.
See https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits for document length limits, maximum batch size, and supported text encoding.
- Parameters
documents (list[str] or list[TextDocumentInput] or list[dict[str, str]]) – The set of documents to process as part of this batch. If you wish to specify the ID and language on a per-item basis you must use as input a list[
TextDocumentInput
] or a list of dict representations ofTextDocumentInput
, like {“id”: “1”, “language”: “en”, “text”: “hello world”}.- Keyword Arguments
language (str) – The 2 letter ISO 639-1 representation of language for the entire batch. For example, use “en” for English; “es” for Spanish etc. If not set, uses “en” for English as default. Per-document language will take precedence over whole batch language. See https://aka.ms/talangs for supported languages in Text Analytics API.
model_version (str) – This value indicates which model will be used for scoring, e.g. “latest”, “2019-10-01”. If a model-version is not specified, the API will default to the latest, non-preview version.
show_stats (bool) – If set to true, response will contain document level statistics.
- Returns
The combined list of
AnalyzeSentimentResult
andDocumentError
in the order the original documents were passed in.- Return type
- Raises
HttpResponseError or TypeError or ValueError –
Example:
from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient endpoint = os.environ["AZURE_TEXT_ANALYTICS_ENDPOINT"] key = os.environ["AZURE_TEXT_ANALYTICS_KEY"] text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key)) documents = [ "I had the best day of my life.", "This was a waste of my time. The speaker put me to sleep.", "No tengo dinero ni nada que dar...", "L'hôtel n'était pas très confortable. L'éclairage était trop sombre." ] result = text_analytics_client.analyze_sentiment(documents) docs = [doc for doc in result if not doc.is_error] for idx, doc in enumerate(docs): print("Document text: {}".format(documents[idx])) print("Overall sentiment: {}".format(doc.sentiment))
-
close
() → None¶ Close sockets opened by the client. Calling this method is unnecessary when using the client as a context manager.
-
detect_language
(**kwargs: Any) → List[Union[DetectLanguageResult, DocumentError]][source]¶ Detect language for a batch of documents.
Returns the detected language and a numeric score between zero and one. Scores close to one indicate 100% certainty that the identified language is true. See https://aka.ms/talangs for the list of enabled languages.
See https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits for document length limits, maximum batch size, and supported text encoding.
- Parameters
documents (list[str] or list[DetectLanguageInput] or list[dict[str, str]]) – The set of documents to process as part of this batch. If you wish to specify the ID and country_hint on a per-item basis you must use as input a list[
DetectLanguageInput
] or a list of dict representations ofDetectLanguageInput
, like {“id”: “1”, “country_hint”: “us”, “text”: “hello world”}.- Keyword Arguments
country_hint (str) – A country hint for the entire batch. Accepts two letter country codes specified by ISO 3166-1 alpha-2. Per-document country hints will take precedence over whole batch hints. Defaults to “US”. If you don’t want to use a country hint, pass the string “none”.
model_version (str) – This value indicates which model will be used for scoring, e.g. “latest”, “2019-10-01”. If a model-version is not specified, the API will default to the latest, non-preview version.
show_stats (bool) – If set to true, response will contain document level statistics.
- Returns
The combined list of
DetectLanguageResult
andDocumentError
in the order the original documents were passed in.- Return type
- Raises
HttpResponseError or TypeError or ValueError –
Example:
from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient endpoint = os.environ["AZURE_TEXT_ANALYTICS_ENDPOINT"] key = os.environ["AZURE_TEXT_ANALYTICS_KEY"] text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key)) documents = [ "This document is written in English.", "Este es un document escrito en Español.", "这是一个用中文写的文件", "Dies ist ein Dokument in deutsche Sprache.", "Detta är ett dokument skrivet på engelska." ] result = text_analytics_client.detect_language(documents) for idx, doc in enumerate(result): if not doc.is_error: print("Document text: {}".format(documents[idx])) print("Language detected: {}".format(doc.primary_language.name)) print("ISO6391 name: {}".format(doc.primary_language.iso6391_name)) print("Confidence score: {}\n".format(doc.primary_language.confidence_score)) if doc.is_error: print(doc.id, doc.error)
-
extract_key_phrases
(**kwargs: Any) → List[Union[ExtractKeyPhrasesResult, DocumentError]][source]¶ Extract key phrases from a batch of documents.
Returns a list of strings denoting the key phrases in the input text. For example, for the input text “The food was delicious and there were wonderful staff”, the API returns the main talking points: “food” and “wonderful staff”
See https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits for document length limits, maximum batch size, and supported text encoding.
- Parameters
documents (list[str] or list[TextDocumentInput] or list[dict[str, str]]) – The set of documents to process as part of this batch. If you wish to specify the ID and language on a per-item basis you must use as input a list[
TextDocumentInput
] or a list of dict representations ofTextDocumentInput
, like {“id”: “1”, “language”: “en”, “text”: “hello world”}.- Keyword Arguments
language (str) – The 2 letter ISO 639-1 representation of language for the entire batch. For example, use “en” for English; “es” for Spanish etc. If not set, uses “en” for English as default. Per-document language will take precedence over whole batch language. See https://aka.ms/talangs for supported languages in Text Analytics API.
model_version (str) – This value indicates which model will be used for scoring, e.g. “latest”, “2019-10-01”. If a model-version is not specified, the API will default to the latest, non-preview version.
show_stats (bool) – If set to true, response will contain document level statistics.
- Returns
The combined list of
ExtractKeyPhrasesResult
andDocumentError
in the order the original documents were passed in.- Return type
- Raises
HttpResponseError or TypeError or ValueError –
Example:
from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient endpoint = os.environ["AZURE_TEXT_ANALYTICS_ENDPOINT"] key = os.environ["AZURE_TEXT_ANALYTICS_KEY"] text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key)) documents = [ "Redmond is a city in King County, Washington, United States, located 15 miles east of Seattle.", "I need to take my cat to the veterinarian.", "I will travel to South America in the summer.", ] result = text_analytics_client.extract_key_phrases(documents) for doc in result: if not doc.is_error: print(doc.key_phrases) if doc.is_error: print(doc.id, doc.error)
-
recognize_entities
(**kwargs: Any) → List[Union[RecognizeEntitiesResult, DocumentError]][source]¶ Recognize entities for a batch of documents.
Identifies and categorizes entities in your text as people, places, organizations, date/time, quantities, percentages, currencies, and more. For the list of supported entity types, check: https://aka.ms/taner
See https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits for document length limits, maximum batch size, and supported text encoding.
- Parameters
documents (list[str] or list[TextDocumentInput] or list[dict[str, str]]) – The set of documents to process as part of this batch. If you wish to specify the ID and language on a per-item basis you must use as input a list[
TextDocumentInput
] or a list of dict representations ofTextDocumentInput
, like {“id”: “1”, “language”: “en”, “text”: “hello world”}.- Keyword Arguments
language (str) – The 2 letter ISO 639-1 representation of language for the entire batch. For example, use “en” for English; “es” for Spanish etc. If not set, uses “en” for English as default. Per-document language will take precedence over whole batch language. See https://aka.ms/talangs for supported languages in Text Analytics API.
model_version (str) – This value indicates which model will be used for scoring, e.g. “latest”, “2019-10-01”. If a model-version is not specified, the API will default to the latest, non-preview version.
show_stats (bool) – If set to true, response will contain document level statistics.
- Returns
The combined list of
RecognizeEntitiesResult
andDocumentError
in the order the original documents were passed in.- Return type
- Raises
HttpResponseError or TypeError or ValueError –
Example:
from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient endpoint = os.environ["AZURE_TEXT_ANALYTICS_ENDPOINT"] key = os.environ["AZURE_TEXT_ANALYTICS_KEY"] text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key)) documents = [ "Microsoft was founded by Bill Gates and Paul Allen.", "I had a wonderful trip to Seattle last week.", "I visited the Space Needle 2 times.", ] result = text_analytics_client.recognize_entities(documents) docs = [doc for doc in result if not doc.is_error] for idx, doc in enumerate(docs): print("\nDocument text: {}".format(documents[idx])) for entity in doc.entities: print("Entity: \t", entity.text, "\tCategory: \t", entity.category, "\tConfidence Score: \t", entity.confidence_score)
-
recognize_linked_entities
(**kwargs: Any) → List[Union[RecognizeLinkedEntitiesResult, DocumentError]][source]¶ Recognize linked entities from a well-known knowledge base for a batch of documents.
Identifies and disambiguates the identity of each entity found in text (for example, determining whether an occurrence of the word Mars refers to the planet, or to the Roman god of war). Recognized entities are associated with URLs to a well-known knowledge base, like Wikipedia.
See https://docs.microsoft.com/azure/cognitive-services/text-analytics/overview#data-limits for document length limits, maximum batch size, and supported text encoding.
- Parameters
documents (list[str] or list[TextDocumentInput] or list[dict[str, str]]) – The set of documents to process as part of this batch. If you wish to specify the ID and language on a per-item basis you must use as input a list[
TextDocumentInput
] or a list of dict representations ofTextDocumentInput
, like {“id”: “1”, “language”: “en”, “text”: “hello world”}.- Keyword Arguments
language (str) – The 2 letter ISO 639-1 representation of language for the entire batch. For example, use “en” for English; “es” for Spanish etc. If not set, uses “en” for English as default. Per-document language will take precedence over whole batch language. See https://aka.ms/talangs for supported languages in Text Analytics API.
model_version (str) – This value indicates which model will be used for scoring, e.g. “latest”, “2019-10-01”. If a model-version is not specified, the API will default to the latest, non-preview version.
show_stats (bool) – If set to true, response will contain document level statistics.
- Returns
The combined list of
RecognizeLinkedEntitiesResult
andDocumentError
in the order the original documents were passed in.- Return type
- Raises
HttpResponseError or TypeError or ValueError –
Example:
from azure.core.credentials import AzureKeyCredential from azure.ai.textanalytics import TextAnalyticsClient endpoint = os.environ["AZURE_TEXT_ANALYTICS_ENDPOINT"] key = os.environ["AZURE_TEXT_ANALYTICS_KEY"] text_analytics_client = TextAnalyticsClient(endpoint=endpoint, credential=AzureKeyCredential(key)) documents = [ "Microsoft moved its headquarters to Bellevue, Washington in January 1979.", "Steve Ballmer stepped down as CEO of Microsoft and was succeeded by Satya Nadella.", "Microsoft superó a Apple Inc. como la compañía más valiosa que cotiza en bolsa en el mundo.", ] result = text_analytics_client.recognize_linked_entities(documents) docs = [doc for doc in result if not doc.is_error] for idx, doc in enumerate(docs): print("Document text: {}\n".format(documents[idx])) for entity in doc.entities: print("Entity: {}".format(entity.name)) print("Url: {}".format(entity.url)) print("Data Source: {}".format(entity.data_source)) for match in entity.matches: print("Confidence Score: {}".format(match.confidence_score)) print("Entity as appears in request: {}".format(match.text)) print("------------------------------------------")
-
class
azure.ai.textanalytics.
TextAnalyticsError
(**kwargs)[source]¶ TextAnalyticsError contains the error code, message, and other details that explain why the batch or individual document failed to be processed by the service.
- Variables
code (str) – Error code. Possible values include: ‘invalidRequest’, ‘invalidArgument’, ‘internalServerError’, ‘serviceUnavailable’, ‘invalidParameterValue’, ‘invalidRequestBodyFormat’, ‘emptyRequest’, ‘missingInputRecords’, ‘invalidDocument’, ‘modelVersionIncorrect’, ‘invalidDocumentBatch’, ‘unsupportedLanguageCode’, ‘invalidCountryHint’
message (str) – Error message.
target (str) – Error target.
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
TextAnalyticsWarning
(**kwargs)[source]¶ TextAnalyticsWarning contains the warning code and message that explains why the response has a warning.
- Variables
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
TextDocumentBatchStatistics
(**kwargs)[source]¶ TextDocumentBatchStatistics contains information about the request payload. Note: This object is not returned in the response and needs to be retrieved by a response hook.
- Variables
document_count (int) – Number of documents submitted in the request.
valid_document_count (int) – Number of valid documents. This excludes empty, over-size limit or non-supported languages documents.
erroneous_document_count (int) – Number of invalid documents. This includes empty, over-size limit or non-supported languages documents.
transaction_count (long) – Number of transactions for the request.
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶
-
class
azure.ai.textanalytics.
TextDocumentInput
(**kwargs)[source]¶ The input document to be analyzed by the service.
- Variables
-
as_dict
(keep_readonly=True, key_transformer=<function attribute_transformer>, **kwargs)¶ Return a dict that can be JSONify using json.dump.
Advanced usage might optionaly use a callback as parameter:
Key is the attribute name used in Python. Attr_desc is a dict of metadata. Currently contains ‘type’ with the msrest type and ‘key’ with the RestAPI encoded key. Value is the current value in this object.
The string returned will be used to serialize the key. If the return type is a list, this is considered hierarchical result dict.
See the three examples in this file:
attribute_transformer
full_restapi_key_transformer
last_restapi_key_transformer
If you want XML serialization, you can pass the kwargs is_xml=True.
- Parameters
key_transformer (function) – A key transformer function.
- Returns
A dict JSON compatible object
- Return type
-
classmethod
deserialize
(data, content_type=None)¶ Parse a str using the RestAPI syntax and return a model.
-
classmethod
enable_additional_properties_sending
()¶
-
classmethod
from_dict
(data, key_extractors=None, content_type=None)¶ Parse a dict using given key extractor return a model.
By default consider key extractors (rest_key_case_insensitive_extractor, attribute_key_case_insensitive_extractor and last_rest_key_case_insensitive_extractor)
-
classmethod
is_xml_model
()¶
-
serialize
(keep_readonly=False, **kwargs)¶ Return the JSON that would be sent to azure from this model.
This is an alias to as_dict(full_restapi_key_transformer, keep_readonly=False).
If you want XML serialization, you can pass the kwargs is_xml=True.
-
class
azure.ai.textanalytics.
TextDocumentStatistics
(**kwargs)[source]¶ TextDocumentStatistics contains information about the document payload.
- Variables
-
get
(key, default=None)¶
-
has_key
(k)¶
-
items
()¶
-
keys
()¶
-
update
(*args, **kwargs)¶
-
values
()¶