azure.cognitiveservices.language.textanalytics package¶
Submodules¶
Module contents¶
-
class
azure.cognitiveservices.language.textanalytics.
TextAnalyticsAPI
(azure_region, credentials)[source]¶ Bases:
object
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
Variables: config (TextAnalyticsAPIConfiguration) – Configuration for client.
Parameters: - azure_region (str or AzureRegions) – Supported Azure regions for Cognitive Services endpoints. Possible values include: ‘westus’, ‘westeurope’, ‘southeastasia’, ‘eastus2’, ‘westcentralus’, ‘westus2’, ‘eastus’, ‘southcentralus’, ‘northeurope’, ‘eastasia’, ‘australiaeast’, ‘brazilsouth’
- credentials (None) – Subscription credentials which uniquely identify client subscription.
-
detect_language
(documents=None, custom_headers=None, raw=False, **operation_config)[source]¶ 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.
Parameters: - documents (list[Input]) –
- custom_headers (dict) – headers that will be added to the request
- raw (bool) – returns the direct response alongside the deserialized response
- operation_config – Operation configuration overrides.
Returns: LanguageBatchResult or ClientRawResponse if raw=true
Return type: LanguageBatchResult or ClientRawResponse
Raises:
-
key_phrases
(documents=None, custom_headers=None, raw=False, **operation_config)[source]¶ The API returns a list of strings denoting the key talking points in the input text.
We employ techniques from Microsoft Office’s sophisticated Natural Language Processing toolkit. See the <a href=”https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages”>Text Analytics Documentation</a> for details about the languages that are supported by key phrase extraction.
Parameters: - documents (list[MultiLanguageInput]) –
- custom_headers (dict) – headers that will be added to the request
- raw (bool) – returns the direct response alongside the deserialized response
- operation_config – Operation configuration overrides.
Returns: KeyPhraseBatchResult or ClientRawResponse if raw=true
Return type: KeyPhraseBatchResult or ClientRawResponse
Raises:
-
sentiment
(documents=None, custom_headers=None, raw=False, **operation_config)[source]¶ 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. Sentiment score is generated using classification techniques. The input features to the classifier include n-grams, features generated from part-of-speech tags, and word embeddings. See the <a href=”https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview#supported-languages”>Text Analytics Documentation</a> for details about the languages that are supported by sentiment analysis.
Parameters: - documents (list[MultiLanguageInput]) –
- custom_headers (dict) – headers that will be added to the request
- raw (bool) – returns the direct response alongside the deserialized response
- operation_config – Operation configuration overrides.
Returns: SentimentBatchResult or ClientRawResponse if raw=true
Return type: SentimentBatchResult or ClientRawResponse
Raises: