TextAnalyticsClient Class
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/en-us/azure/cognitive-services/text-analytics/overview
- Inheritance
-
TextAnalyticsClient
Constructor
TextAnalyticsClient(endpoint, credentials)
Parameters
- endpoint
- str
Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com).
Variables
Configuration for client.
Methods
| detect_language |
The API returns the detected language and a numeric score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported. |
| entities |
The API returns a list of recognized entities in a given document. To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the Supported languages in Text Analytics API for the list of enabled languages. |
| key_phrases |
The API returns a list of strings denoting the key talking points in the input text. See the Text Analytics Documentation for details about the languages that are supported by key phrase extraction. |
| sentiment |
The API returns a numeric score between 0 and 1. Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the Text Analytics Documentation for details about the languages that are supported by sentiment analysis. |
detect_language
The API returns the detected language and a numeric score between 0 and 1.
Scores close to 1 indicate 100% certainty that the identified language is true. A total of 120 languages are supported.
detect_language(show_stats=None, documents=None, custom_headers=None, raw=False, **operation_config)
Parameters
- show_stats
- bool
(optional) if set to true, response will contain input and document level statistics.
- documents
- list[LanguageInput]
- operation_config
Operation configuration overrides.
Returns
LanguageBatchResult or ClientRawResponse if raw=true
Return type
Exceptions
entities
The API returns a list of recognized entities in a given document.
To get even more information on each recognized entity we recommend using the Bing Entity Search API by querying for the recognized entities names. See the Supported languages in Text Analytics API for the list of enabled languages.
entities(show_stats=None, documents=None, custom_headers=None, raw=False, **operation_config)
Parameters
- show_stats
- bool
(optional) if set to true, response will contain input and document level statistics.
- documents
- list[MultiLanguageInput]
- operation_config
Operation configuration overrides.
Returns
EntitiesBatchResult or ClientRawResponse if raw=true
Return type
Exceptions
key_phrases
The API returns a list of strings denoting the key talking points in the input text.
See the Text Analytics Documentation for details about the languages that are supported by key phrase extraction.
key_phrases(show_stats=None, documents=None, custom_headers=None, raw=False, **operation_config)
Parameters
- show_stats
- bool
(optional) if set to true, response will contain input and document level statistics.
- documents
- list[MultiLanguageInput]
- operation_config
Operation configuration overrides.
Returns
KeyPhraseBatchResult or ClientRawResponse if raw=true
Return type
Exceptions
sentiment
The API returns a numeric score between 0 and 1.
Scores close to 1 indicate positive sentiment, while scores close to 0 indicate negative sentiment. A score of 0.5 indicates the lack of sentiment (e.g. a factoid statement). See the Text Analytics Documentation for details about the languages that are supported by sentiment analysis.
sentiment(show_stats=None, documents=None, custom_headers=None, raw=False, **operation_config)
Parameters
- show_stats
- bool
(optional) if set to true, response will contain input and document level statistics.
- documents
- list[MultiLanguageInput]
- operation_config
Operation configuration overrides.
Returns
object or ClientRawResponse if raw=true
Return type
Exceptions
Feedback
Submit and view feedback for