1.0.0b1 (2020-01-09)
Version (1.0.0b1) is the first preview of our efforts to create a user-friendly and Pythonic client library for Azure Text Analytics. For more information about this, and preview releases of other Azure SDK libraries, please visit
https://azure.github.io/azure-sdk/releases/latest/python.html.
Breaking changes: New API design
-
New namespace/package name:
- The namespace/package name for Azure Text Analytics client library has changed from
azure.cognitiveservices.language.textanalytics
toazure.ai.textanalytics
- The namespace/package name for Azure Text Analytics client library has changed from
-
New operations and naming:
detect_language
is renamed todetect_languages
entities
is renamed torecognize_entities
key_phrases
is renamed toextract_key_phrases
sentiment
is renamed toanalyze_sentiment
- New operation
recognize_pii_entities
finds personally identifiable information entities in text - New operation
recognize_linked_entities
provides links from a well-known knowledge base for each recognized entity - New module-level operations
single_detect_language
,single_recognize_entities
,single_extract_key_phrases
,single_analyze_sentiment
,single_recognize_pii_entities
, andsingle_recognize_linked_entities
perform
function on a single string instead of a batch of text documents and can be imported from theazure.ai.textanalytics
namespace. - New client and module-level async APIs added to subnamespace
azure.ai.textanalytics.aio
. MultiLanguageInput
has been renamed toTextDocumentInput
LanguageInput
has been renamed toDetectLanguageInput
DocumentLanguage
has been renamed toDetectLanguageResult
DocumentEntities
has been renamed toRecognizeEntitiesResult
DocumentLinkedEntities
has been renamed toRecognizeLinkedEntitiesResult
DocumentKeyPhrases
has been renamed toExtractKeyPhrasesResult
DocumentSentiment
has been renamed toAnalyzeSentimentResult
DocumentStatistics
has been renamed toTextDocumentStatistics
RequestStatistics
has been renamed toTextDocumentBatchStatistics
Entity
has been renamed toNamedEntity
Match
has been renamed toLinkedEntityMatch
- The batching methods'
documents
parameter has been renamedinputs
-
New input types:
detect_languages
can take as input alist[DetectLanguageInput]
or alist[str]
. A list of dict-like objects in the same shape asDetectLanguageInput
is still accepted as input.recognize_entities
,recognize_pii_entities
,recognize_linked_entities
,extract_key_phrases
,analyze_sentiment
can take as input alist[TextDocumentInput]
orlist[str]
.
A list of dict-like objects in the same shape asTextDocumentInput
is still accepted as input.
-
New parameters/keyword arguments:
- All operations now take a keyword argument
model_version
which allows the user to specify a string referencing the desired model version to be used for analysis. If no string specified, it will default to the latest, non-preview version. detect_languages
now takes a parametercountry_hint
which allows you to specify the country hint for the entire batch. Any per-item country hints will take precedence over a whole batch hint.recognize_entities
,recognize_pii_entities
,recognize_linked_entities
,extract_key_phrases
,analyze_sentiment
now take a parameterlanguage
which allows you to specify the language for the entire batch.
Any per-item specified language will take precedence over a whole batch hint.- A
default_country_hint
ordefault_language
keyword argument can be passed at client instantiation to set the default values for all operations. - A
response_hook
keyword argument can be passed with a callback to use the raw response from the service. Additionally, values returned forTextDocumentBatchStatistics
andmodel_version
used must be retrieved using a response hook. show_stats
andmodel_version
parameters move to keyword only arguments.
- All operations now take a keyword argument
-
New return types
- The return types for the batching methods (
detect_languages
,recognize_entities
,recognize_pii_entities
,recognize_linked_entities
,extract_key_phrases
,analyze_sentiment
) now return a heterogeneous list of
result objects and document errors in the order passed in with the request. To iterate over the list and filter for result or error, a boolean property on each object calledis_error
can be used to determine whether the returned response object at
that index is a result or an error: detect_languages
now returns a List[Union[DetectLanguageResult
,DocumentError
]]recognize_entities
now returns a List[Union[RecognizeEntitiesResult
,DocumentError
]]recognize_pii_entities
now returns a List[Union[RecognizePiiEntitiesResult
,DocumentError
]]recognize_linked_entities
now returns a List[Union[RecognizeLinkedEntitiesResult
,DocumentError
]]extract_key_phrases
now returns a List[Union[ExtractKeyPhrasesResult
,DocumentError
]]analyze_sentiment
now returns a List[Union[AnalyzeSentimentResult
,DocumentError
]]- The module-level, single text operations will return a single result object or raise the error found on the document:
single_detect_languages
returns aDetectLanguageResult
single_recognize_entities
returns aRecognizeEntitiesResult
single_recognize_pii_entities
returns aRecognizePiiEntitiesResult
single_recognize_linked_entities
returns aRecognizeLinkedEntitiesResult
single_extract_key_phrases
returns aExtractKeyPhrasesResult
single_analyze_sentiment
returns aAnalyzeSentimentResult
- The return types for the batching methods (
-
New underlying REST pipeline implementation, based on the new
azure-core
library. -
Client and pipeline configuration is now available via keyword arguments at both the client level, and per-operation. See README for a full list of optional configuration arguments.
-
Authentication using
azure-identity
credentials- see the
Azure Identity documentation
for more information
- see the
-
New error hierarchy:
- All service errors will now use the base type:
azure.core.exceptions.HttpResponseError
- There is one exception type derived from this base type for authentication errors:
ClientAuthenticationError
: Authentication failed.
- All service errors will now use the base type: