Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ class DocumentLanguage(msrest.serialization.Model):

:param id: Required. Unique, non-empty document identifier.
:type id: str
:param detected_languages: Required. A list of extracted languages.
:type detected_languages: list[~azure.ai.textanalytics.models.DetectedLanguage]
:param detected_language: Required. Detected Language.
:type detected_language: ~azure.ai.textanalytics.models.DetectedLanguage
:param warnings: Required. Warnings encountered while processing document.
:type warnings: list[~azure.ai.textanalytics.models.TextAnalyticsWarning]
:param statistics: if showStats=true was specified in the request this field will contain
Expand All @@ -176,13 +176,13 @@ class DocumentLanguage(msrest.serialization.Model):

_validation = {
'id': {'required': True},
'detected_languages': {'required': True},
'detected_language': {'required': True},
'warnings': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'detected_languages': {'key': 'detectedLanguages', 'type': '[DetectedLanguage]'},
'detected_language': {'key': 'detectedLanguage', 'type': 'DetectedLanguage'},
'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'},
'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'},
}
Expand All @@ -193,7 +193,7 @@ def __init__(
):
super(DocumentLanguage, self).__init__(**kwargs)
self.id = kwargs['id']
self.detected_languages = kwargs['detected_languages']
self.detected_language = kwargs['detected_language']
self.warnings = kwargs['warnings']
self.statistics = kwargs.get('statistics', None)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ class DocumentLanguage(msrest.serialization.Model):

:param id: Required. Unique, non-empty document identifier.
:type id: str
:param detected_languages: Required. A list of extracted languages.
:type detected_languages: list[~azure.ai.textanalytics.models.DetectedLanguage]
:param detected_language: Required. Detected Language.
:type detected_language: ~azure.ai.textanalytics.models.DetectedLanguage
:param warnings: Required. Warnings encountered while processing document.
:type warnings: list[~azure.ai.textanalytics.models.TextAnalyticsWarning]
:param statistics: if showStats=true was specified in the request this field will contain
Expand All @@ -197,13 +197,13 @@ class DocumentLanguage(msrest.serialization.Model):

_validation = {
'id': {'required': True},
'detected_languages': {'required': True},
'detected_language': {'required': True},
'warnings': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'detected_languages': {'key': 'detectedLanguages', 'type': '[DetectedLanguage]'},
'detected_language': {'key': 'detectedLanguage', 'type': 'DetectedLanguage'},
'warnings': {'key': 'warnings', 'type': '[TextAnalyticsWarning]'},
'statistics': {'key': 'statistics', 'type': 'DocumentStatistics'},
}
Expand All @@ -212,14 +212,14 @@ def __init__(
self,
*,
id: str,
detected_languages: List["DetectedLanguage"],
detected_language: "DetectedLanguage",
warnings: List["TextAnalyticsWarning"],
statistics: Optional["DocumentStatistics"] = None,
**kwargs
):
super(DocumentLanguage, self).__init__(**kwargs)
self.id = id
self.detected_languages = detected_languages
self.detected_language = detected_language
self.warnings = warnings
self.statistics = statistics

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def wrapper(response, obj, response_headers): # pylint: disable=unused-argument
def language_result(language):
return DetectLanguageResult(
id=language.id,
primary_language=DetectedLanguage._from_generated(language.detected_languages[0]), # pylint: disable=protected-access
primary_language=DetectedLanguage._from_generated(language.detected_language), # pylint: disable=protected-access
statistics=TextDocumentStatistics._from_generated(language.statistics), # pylint: disable=protected-access
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
interactions:
- request:
body: '{"documents": [{"id": "1", "text": "I should take my cat to the veterinarian.",
"countryHint": "US"}, {"id": "2", "text": "Este es un document escrito en Espa\u00f1ol.",
"countryHint": "US"}, {"id": "3", "text": "\u732b\u306f\u5e78\u305b", "countryHint":
"US"}, {"id": "4", "text": "Fahrt nach Stuttgart und dann zum Hotel zu Fu.",
"countryHint": "US"}]}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '354'
Content-Type:
- application/json
User-Agent:
- azsdk-python-ai-textanalytics/1.0.0b5 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
method: POST
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/languages?showStats=true
response:
body:
string: '{"statistics":{"documentsCount":4,"validDocumentsCount":4,"erroneousDocumentsCount":0,"transactionsCount":4},"documents":[{"id":"1","detectedLanguage":{"name":"English","iso6391Name":"en","confidenceScore":1.0},"statistics":{"charactersCount":41,"transactionsCount":1},"warnings":[]},{"id":"2","detectedLanguage":{"name":"Spanish","iso6391Name":"es","confidenceScore":1.0},"statistics":{"charactersCount":39,"transactionsCount":1},"warnings":[]},{"id":"3","detectedLanguage":{"name":"Japanese","iso6391Name":"ja","confidenceScore":1.0},"statistics":{"charactersCount":4,"transactionsCount":1},"warnings":[]},{"id":"4","detectedLanguage":{"name":"German","iso6391Name":"de","confidenceScore":1.0},"statistics":{"charactersCount":46,"transactionsCount":1},"warnings":[]}],"errors":[],"modelVersion":"2019-10-01"}'
headers:
apim-request-id:
- dd298980-e91e-4583-bf91-0f8007667eff
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- CognitiveServices.TextAnalytics.BatchScoring=4
date:
- Mon, 27 Apr 2020 17:33:43 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '19'
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
interactions:
- request:
body: '{"documents": [{"id": "1", "text": "I should take my cat to the veterinarian",
"language": "US"}, {"id": "2", "text": "Este es un document escrito en Espa\u00f1ol.",
"language": "US"}, {"id": "3", "text": "\u732b\u306f\u5e78\u305b", "language":
"US"}, {"id": "4", "text": "Fahrt nach Stuttgart und dann zum Hotel zu Fu.",
"language": "US"}]}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
Connection:
- keep-alive
Content-Length:
- '341'
Content-Type:
- application/json
User-Agent:
- azsdk-python-ai-textanalytics/1.0.0b5 Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
Python/3.7.7 (Darwin-17.7.0-x86_64-i386-64bit)
method: POST
uri: https://westus2.ppe.cognitiveservices.azure.com/text/analytics/v3.0/languages?showStats=false
response:
body:
string: '{"documents":[{"id":"1","detectedLanguage":{"name":"English","iso6391Name":"en","confidenceScore":1.0},"warnings":[]},{"id":"2","detectedLanguage":{"name":"Spanish","iso6391Name":"es","confidenceScore":1.0},"warnings":[]},{"id":"3","detectedLanguage":{"name":"Japanese","iso6391Name":"ja","confidenceScore":1.0},"warnings":[]},{"id":"4","detectedLanguage":{"name":"German","iso6391Name":"de","confidenceScore":1.0},"warnings":[]}],"errors":[],"modelVersion":"2019-10-01"}'
headers:
apim-request-id:
- 981a315d-c5dc-499b-90b6-136b560f8dd8
content-type:
- application/json; charset=utf-8
csp-billing-usage:
- CognitiveServices.TextAnalytics.BatchScoring=4
date:
- Mon, 27 Apr 2020 17:33:44 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '4'
status:
code: 200
message: OK
version: 1
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ interactions:
subscription and use a correct regional API endpoint for your resource."}}'
headers:
apim-request-id:
- 4249adf5-1b75-4725-9b2a-a3def110d26e
- 2e05796d-4894-41e8-abc6-c170383fa85c
content-length:
- '225'
content-type:
- application/json
date:
- Wed, 22 Apr 2020 22:46:50 GMT
- Mon, 27 Apr 2020 17:33:44 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
www-authenticate:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ interactions:
is incorrect. Allowed values are latest,2019-10-01"}}'
headers:
apim-request-id:
- 3311ba23-80c3-42cc-b9ff-5d7d1bc178e8
- b6be92e7-8a88-41b6-be2c-7e9b62e95356
content-type:
- application/json; charset=utf-8
date:
- Wed, 22 Apr 2020 22:46:50 GMT
- Mon, 27 Apr 2020 17:33:45 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '145'
- '4'
status:
code: 400
message: Bad Request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,19 @@ interactions:
is incorrect. Allowed values are latest,2019-10-01"}}'
headers:
apim-request-id:
- 200e6b5e-385f-48e9-999d-9e008d7ff34c
- a1d6c660-a438-4b1b-b77c-cbdf54eb4f55
content-type:
- application/json; charset=utf-8
date:
- Wed, 22 Apr 2020 22:46:51 GMT
- Mon, 27 Apr 2020 17:33:45 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '127'
- '3'
status:
code: 400
message: Bad Request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -773,19 +773,19 @@ interactions:
request contains too many records. Max 1000 records are permitted."}}}'
headers:
apim-request-id:
- 139bb311-dd88-444f-98c5-2942d03af785
- 200f2284-6ccd-42df-a46f-1167f3a01644
content-type:
- application/json; charset=utf-8
date:
- Wed, 22 Apr 2020 22:46:52 GMT
- Mon, 27 Apr 2020 17:33:46 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '43'
- '23'
status:
code: 400
message: Bad Request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,19 +738,19 @@ interactions:
request contains too many records. Max 1000 records are permitted."}}}'
headers:
apim-request-id:
- 81d7a3b9-afb8-4ab6-a3a2-08389590a3e0
- f4d44e86-cc1b-44f3-9ed4-5ed70fc4c119
content-type:
- application/json; charset=utf-8
date:
- Wed, 22 Apr 2020 22:46:53 GMT
- Mon, 27 Apr 2020 17:33:47 GMT
strict-transport-security:
- max-age=31536000; includeSubDomains; preload
transfer-encoding:
- chunked
x-content-type-options:
- nosniff
x-envoy-upstream-service-time:
- '218'
- '25'
status:
code: 400
message: Bad Request
Expand Down
Loading