-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[text analytics] return None for offset and length for v3.0 #13382
Merged
iscai-msft
merged 4 commits into
Azure:master
from
iscai-msft:return_none_for_offset_length_v3
Aug 28, 2020
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
7450dfc
return None for offset and length if api version is v3.0
iscai-msft f0bc964
add tests
iscai-msft d08baa6
Merge branch 'master' of https://github.com/Azure/azure-sdk-for-pytho…
iscai-msft 3c226d2
fix entity indexing in test for linked entities
iscai-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
.../tests/recordings/test_analyze_sentiment.test_no_offset_length_v3_sentence_sentiment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
interactions: | ||
- request: | ||
body: '{"documents": [{"id": "0", "text": "I like nature. I do not like being | ||
inside", "language": "en"}]}' | ||
headers: | ||
Accept: | ||
- application/json, text/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '99' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-ai-textanalytics/5.0.1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: POST | ||
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.0/sentiment?showStats=false | ||
response: | ||
body: | ||
string: '{"documents":[{"id":"0","sentiment":"mixed","confidenceScores":{"positive":0.44,"neutral":0.27,"negative":0.29},"sentences":[{"sentiment":"positive","confidenceScores":{"positive":0.88,"neutral":0.11,"negative":0.01},"offset":0,"length":14,"text":"I | ||
like nature."},{"sentiment":"negative","confidenceScores":{"positive":0.01,"neutral":0.43,"negative":0.56},"offset":15,"length":26,"text":"I | ||
do not like being inside"}],"warnings":[]}],"errors":[],"modelVersion":"2020-04-01"}' | ||
headers: | ||
apim-request-id: | ||
- 94e0a047-a7be-4d12-a4ec-81ef3f496950 | ||
content-type: | ||
- application/json; charset=utf-8 | ||
csp-billing-usage: | ||
- CognitiveServices.TextAnalytics.BatchScoring=1 | ||
date: | ||
- Thu, 27 Aug 2020 20:56:20 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
transfer-encoding: | ||
- chunked | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '78' | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
45 changes: 45 additions & 0 deletions
45
...cs/azure-ai-textanalytics/tests/recordings/test_analyze_sentiment.test_offset_length.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
interactions: | ||
- request: | ||
body: '{"documents": [{"id": "0", "text": "I like nature. I do not like being | ||
inside", "language": "en"}]}' | ||
headers: | ||
Accept: | ||
- application/json, text/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '99' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-ai-textanalytics/5.0.1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: POST | ||
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.1-preview.1/sentiment?showStats=false&stringIndexType=UnicodeCodePoint | ||
response: | ||
body: | ||
string: '{"documents":[{"id":"0","sentiment":"mixed","confidenceScores":{"positive":0.44,"neutral":0.27,"negative":0.29},"sentences":[{"sentiment":"positive","confidenceScores":{"positive":0.88,"neutral":0.11,"negative":0.01},"offset":0,"length":14,"text":"I | ||
like nature."},{"sentiment":"negative","confidenceScores":{"positive":0.01,"neutral":0.43,"negative":0.56},"offset":15,"length":26,"text":"I | ||
do not like being inside"}],"warnings":[]}],"errors":[],"modelVersion":"2020-04-01"}' | ||
headers: | ||
apim-request-id: | ||
- c1dc9d16-85c8-420d-95a1-76b21edbb06f | ||
content-type: | ||
- application/json; charset=utf-8 | ||
csp-billing-usage: | ||
- CognitiveServices.TextAnalytics.BatchScoring=1 | ||
date: | ||
- Fri, 28 Aug 2020 18:31:18 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
transfer-encoding: | ||
- chunked | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '81' | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
34 changes: 34 additions & 0 deletions
34
.../recordings/test_analyze_sentiment_async.test_no_offset_length_v3_sentence_sentiment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
interactions: | ||
- request: | ||
body: '{"documents": [{"id": "0", "text": "I like nature. I do not like being | ||
inside", "language": "en"}]}' | ||
headers: | ||
Accept: | ||
- application/json, text/json | ||
Content-Length: | ||
- '99' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-ai-textanalytics/5.0.1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: POST | ||
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.0/sentiment?showStats=false | ||
response: | ||
body: | ||
string: '{"documents":[{"id":"0","sentiment":"mixed","confidenceScores":{"positive":0.44,"neutral":0.27,"negative":0.29},"sentences":[{"sentiment":"positive","confidenceScores":{"positive":0.88,"neutral":0.11,"negative":0.01},"offset":0,"length":14,"text":"I | ||
like nature."},{"sentiment":"negative","confidenceScores":{"positive":0.01,"neutral":0.43,"negative":0.56},"offset":15,"length":26,"text":"I | ||
do not like being inside"}],"warnings":[]}],"errors":[],"modelVersion":"2020-04-01"}' | ||
headers: | ||
apim-request-id: 0577ce48-c371-418e-b478-cc085c7ecaf8 | ||
content-type: application/json; charset=utf-8 | ||
csp-billing-usage: CognitiveServices.TextAnalytics.BatchScoring=1 | ||
date: Thu, 27 Aug 2020 20:56:21 GMT | ||
strict-transport-security: max-age=31536000; includeSubDomains; preload | ||
transfer-encoding: chunked | ||
x-content-type-options: nosniff | ||
x-envoy-upstream-service-time: '79' | ||
status: | ||
code: 200 | ||
message: OK | ||
url: https://westus2.api.cognitive.microsoft.com//text/analytics/v3.0/sentiment?showStats=false | ||
version: 1 |
34 changes: 34 additions & 0 deletions
34
...re-ai-textanalytics/tests/recordings/test_analyze_sentiment_async.test_offset_length.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
interactions: | ||
- request: | ||
body: '{"documents": [{"id": "0", "text": "I like nature. I do not like being | ||
inside", "language": "en"}]}' | ||
headers: | ||
Accept: | ||
- application/json, text/json | ||
Content-Length: | ||
- '99' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-ai-textanalytics/5.0.1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: POST | ||
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.1-preview.1/sentiment?showStats=false&stringIndexType=UnicodeCodePoint | ||
response: | ||
body: | ||
string: '{"documents":[{"id":"0","sentiment":"mixed","confidenceScores":{"positive":0.44,"neutral":0.27,"negative":0.29},"sentences":[{"sentiment":"positive","confidenceScores":{"positive":0.88,"neutral":0.11,"negative":0.01},"offset":0,"length":14,"text":"I | ||
like nature."},{"sentiment":"negative","confidenceScores":{"positive":0.01,"neutral":0.43,"negative":0.56},"offset":15,"length":26,"text":"I | ||
do not like being inside"}],"warnings":[]}],"errors":[],"modelVersion":"2020-04-01"}' | ||
headers: | ||
apim-request-id: 22d88cc1-51fb-48e0-a335-d14b72e1d125 | ||
content-type: application/json; charset=utf-8 | ||
csp-billing-usage: CognitiveServices.TextAnalytics.BatchScoring=1 | ||
date: Fri, 28 Aug 2020 18:31:18 GMT | ||
strict-transport-security: max-age=31536000; includeSubDomains; preload | ||
transfer-encoding: chunked | ||
x-content-type-options: nosniff | ||
x-envoy-upstream-service-time: '92' | ||
status: | ||
code: 200 | ||
message: OK | ||
url: https://westus2.api.cognitive.microsoft.com//text/analytics/v3.1-preview.1/sentiment?showStats=false&stringIndexType=UnicodeCodePoint | ||
version: 1 |
45 changes: 45 additions & 0 deletions
45
...sts/recordings/test_recognize_entities.test_no_offset_length_v3_categorized_entities.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
interactions: | ||
- request: | ||
body: '{"documents": [{"id": "0", "text": "Microsoft was founded by Bill Gates | ||
and Paul Allen", "language": "en"}]}' | ||
headers: | ||
Accept: | ||
- application/json, text/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '108' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-ai-textanalytics/5.0.1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: POST | ||
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.0/entities/recognition/general?showStats=false | ||
response: | ||
body: | ||
string: '{"documents":[{"id":"0","entities":[{"text":"Microsoft","category":"Organization","offset":0,"length":9,"confidenceScore":0.82},{"text":"Bill | ||
Gates","category":"Person","offset":25,"length":10,"confidenceScore":0.84},{"text":"Paul | ||
Allen","category":"Person","offset":40,"length":10,"confidenceScore":0.89}],"warnings":[]}],"errors":[],"modelVersion":"2020-04-01"}' | ||
headers: | ||
apim-request-id: | ||
- 8ebab42d-0090-4d36-8e52-721f4c4b87d7 | ||
content-type: | ||
- application/json; charset=utf-8 | ||
csp-billing-usage: | ||
- CognitiveServices.TextAnalytics.BatchScoring=1 | ||
date: | ||
- Thu, 27 Aug 2020 20:56:21 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
transfer-encoding: | ||
- chunked | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '82' | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
45 changes: 45 additions & 0 deletions
45
...s/azure-ai-textanalytics/tests/recordings/test_recognize_entities.test_offset_length.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
interactions: | ||
- request: | ||
body: '{"documents": [{"id": "0", "text": "Microsoft was founded by Bill Gates | ||
and Paul Allen", "language": "en"}]}' | ||
headers: | ||
Accept: | ||
- application/json, text/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '108' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-ai-textanalytics/5.0.1 Python/3.8.5 (macOS-10.13.6-x86_64-i386-64bit) | ||
method: POST | ||
uri: https://westus2.api.cognitive.microsoft.com/text/analytics/v3.1-preview.1/entities/recognition/general?showStats=false&stringIndexType=UnicodeCodePoint | ||
response: | ||
body: | ||
string: '{"documents":[{"id":"0","entities":[{"text":"Microsoft","category":"Organization","offset":0,"length":9,"confidenceScore":0.82},{"text":"Bill | ||
Gates","category":"Person","offset":25,"length":10,"confidenceScore":0.84},{"text":"Paul | ||
Allen","category":"Person","offset":40,"length":10,"confidenceScore":0.89}],"warnings":[]}],"errors":[],"modelVersion":"2020-04-01"}' | ||
headers: | ||
apim-request-id: | ||
- c588af7e-ff6c-4bca-9be0-bc50b81df611 | ||
content-type: | ||
- application/json; charset=utf-8 | ||
csp-billing-usage: | ||
- CognitiveServices.TextAnalytics.BatchScoring=1 | ||
date: | ||
- Fri, 28 Aug 2020 18:31:19 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
transfer-encoding: | ||
- chunked | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '80' | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this the pattern other libraries have taken? I am new to this paradigm as in TA and FR we can only support one version of the SDK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for python, we're supposed to support all API versions, the user only needs to pass in the api_version as a kwarg if they don't want the default.