Skip to content

Commit

Permalink
[textanalytics] correct cspell errors (Azure#23035)
Browse files Browse the repository at this point in the history
* correct cspell errors for TA

* rerecord tests where the input was changed due to spelling
  • Loading branch information
kristapratico authored Feb 15, 2022
1 parent e510962 commit 803e9e4
Show file tree
Hide file tree
Showing 16 changed files with 299 additions and 161 deletions.
49 changes: 48 additions & 1 deletion .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
"sdk/translation/azure-ai-translation-document/samples/assets/**",
"sdk/translation/azure-ai-translation-document/tests/glossaries-valid.csv",
"sdk/tables/azure-data-tables/**",
"sdk/textanalytics/azure-ai-textanalytics/**",
"sdk/storage/azure-storage-blob/**",
"eng/**/*.json",
"eng/*.txt",
Expand Down Expand Up @@ -209,11 +208,13 @@
"pschema",
"PSECRET",
"pygobject",
"parameterizing",
"pytz",
"pywin",
"rdbms",
"reauthenticated",
"reimage",
"revascularization",
"rollup",
"rtsp",
"rtype",
Expand All @@ -239,6 +240,7 @@
"urandom",
"urlsafeb",
"urlunparse",
"usgov",
"usdodcentral",
"usdodeast",
"usgovarizona",
Expand Down Expand Up @@ -276,6 +278,51 @@
"words": [
"essai"
]
},
{
"filename": "sdk/textanalytics/azure-ai-textanalytics/**",
"words": [
"Forndexter",
"ESDNI",
"dinero",
"IOHTTP",
"Zocor",
"dann",
"dont",
"UMLS",
"nach",
"año",
"BRCPF",
"abril",
"zalgo",
"n'était",
"tengo",
"IDRG",
"était",
"gegründet",
"L'hôtel",
"Hola",
"hola",
"escrito",
"Coumadin",
"EUGPS",
"dokument",
"wurde",
"Detta",
"IFIC",
"Fahrt",
"documento",
"scritto",
"USUK",
"Sprache",
"PLREGON",
"Fusce",
"Inigo",
"italiano",
"skrivet",
"verfasst",
"engelska"
]
}
],
"allowCompoundWords": true
Expand Down
2 changes: 1 addition & 1 deletion sdk/textanalytics/azure-ai-textanalytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ This version uses a next-generation code generator that *might* introduce breaki
At a glance:

- "is" should not be used at all.
- "format" will return the string value, where "%s" string formatting will return `NameOfEnum.stringvalue`. Format syntax should be prefered.
- "format" will return the string value, where "%s" string formatting will return `NameOfEnum.stringvalue`. Format syntax should be preferred.

**Bugfixes**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ class HealthcareRelationRole(DictMixin):
For example, in "The subject took 100 mg of ibuprofen",
"100 mg" is a dosage entity fulfilling the role "Dosage"
in the extracted relation "DosageofMedication".
in the extracted relation "DosageOfMedication".
:ivar name: The role of the entity in the relationship. I.e., in the relation
"The subject took 100 mg of ibuprofen", the dosage entity "100 mg" has role
Expand All @@ -606,10 +606,10 @@ def __init__(self, **kwargs):

@staticmethod
def _get_entity(healthcare_role_result, entities):
nums = _get_indices(healthcare_role_result.ref)
entity_index = nums[
numbers = _get_indices(healthcare_role_result.ref)
entity_index = numbers[
1
] # first num parsed from index is document #, second is entity index
] # first number parsed from index is document #, second is entity index
return entities[entity_index]

@classmethod
Expand Down Expand Up @@ -1559,9 +1559,9 @@ def _get_assessments(
]
assessments = []
for assessment_relation in assessment_relations:
nums = _get_indices(assessment_relation)
sentence_index = nums[1]
assessment_index = nums[2]
numbers = _get_indices(assessment_relation)
sentence_index = numbers[1]
assessment_index = numbers[2]
assessments.append(
sentiment.sentences[sentence_index].assessments[assessment_index]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def sample_extract_key_phrases_async():
articles = [
"""
Washington, D.C. Autumn in DC is a uniquely beautiful season. The leaves fall from the trees
in a city chockful of forrests, leaving yellow leaves on the ground and a clearer view of the
in a city chock-full of forests, leaving yellow leaves on the ground and a clearer view of the
blue sky above...
""",
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def sample_recognize_linked_entities_async():
Microsoft was founded by Bill Gates with some friends he met at Harvard. One of his friends,
Steve Ballmer, eventually became CEO after Bill Gates as well. Steve Ballmer eventually stepped
down as CEO of Microsoft, and was succeeded by Satya Nadella.
Microsoft originally moved its headquarters to Bellevue, Wahsington in Januaray 1979, but is now
Microsoft originally moved its headquarters to Bellevue, Washington in January 1979, but is now
headquartered in Redmond.
"""
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
async def sample_recognize_pii_entities_async():
print(
"In this sample we will be going through our customer's loan payment information and redacting "
"all PII (personally identifable information) before storing this information on our public website. "
"all PII (personally identifiable information) before storing this information on our public website. "
"I'm also looking to explicitly extract the SSN information, so I can update my database with SSNs for "
"our customers"
)
Expand Down Expand Up @@ -73,14 +73,14 @@ async def sample_recognize_pii_entities_async():
"I also want to be fairly confident that what I'm storing is an SSN, so let's also "
"ensure that we're > 60% positive the entity is a SSN"
)
ssns = []
social_security_numbers = []
for doc in docs:
for entity in doc.entities:
if entity.category == 'USSocialSecurityNumber' and entity.confidence_score >= 0.6:
ssns.append(entity.text)
social_security_numbers.append(entity.text)

print("We have extracted the following SSNs as well: '{}'".format(
"', '".join(ssns)
"', '".join(social_security_numbers)
))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def sample_extract_key_phrases():
articles = [
"""
Washington, D.C. Autumn in DC is a uniquely beautiful season. The leaves fall from the trees
in a city chockful of forrests, leaving yellow leaves on the ground and a clearer view of the
in a city chock-full of forests, leaving yellow leaves on the ground and a clearer view of the
blue sky above...
""",
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def sample_recognize_linked_entities():
Microsoft was founded by Bill Gates with some friends he met at Harvard. One of his friends,
Steve Ballmer, eventually became CEO after Bill Gates as well. Steve Ballmer eventually stepped
down as CEO of Microsoft, and was succeeded by Satya Nadella.
Microsoft originally moved its headquarters to Bellevue, Wahsington in Januaray 1979, but is now
Microsoft originally moved its headquarters to Bellevue, Washington in January 1979, but is now
headquartered in Redmond.
"""
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
def sample_recognize_pii_entities():
print(
"In this sample we will be going through our customer's loan payment information and redacting "
"all PII (personally identifable information) before storing this information on our public website. "
"all PII (personally identifiable information) before storing this information on our public website. "
"I'm also looking to explicitly extract the SSN information, so I can update my database with SSNs for "
"our customers"
)
Expand Down Expand Up @@ -71,14 +71,14 @@ def sample_recognize_pii_entities():
"I also want to be fairly confident that what I'm storing is an SSN, so let's also "
"ensure that we're > 60% positive the entity is a SSN"
)
ssns = []
social_security_numbers = []
for doc in docs:
for entity in doc.entities:
if entity.category == 'USSocialSecurityNumber' and entity.confidence_score >= 0.6:
ssns.append(entity.text)
social_security_numbers.append(entity.text)

print("We have extracted the following SSNs as well: '{}'".format(
"', '".join(ssns)
"', '".join(social_security_numbers)
))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,50 +7,83 @@
"Accept": "application/json, text/json",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"Content-Length": "2177",
"Content-Length": "2179",
"Content-Type": "application/json",
"User-Agent": "azsdk-python-ai-textanalytics/5.2.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0)",
"x-ms-client-request-id": "25293ed1-5d0f-11ec-aac3-b831b58100e8"
"x-ms-client-request-id": "6e622223-8b89-11ec-91fe-b831b58100e8"
},
"RequestBody": {
"tasks": {
"entityRecognitionTasks": [],
"entityRecognitionPiiTasks": [],
"keyPhraseExtractionTasks": [],
"entityLinkingTasks": [],
"sentimentAnalysisTasks": [],
"extractiveSummarizationTasks": [
{
"parameters": {
"stringIndexType": "UnicodeCodePoint"
},
"taskName": "0"
}
],
"customEntityRecognitionTasks": [],
"customSingleClassificationTasks": [],
"customMultiClassificationTasks": []
},
"analysisInput": {
"documents": [
{
"id": "1",
"text": "The government of British Prime Minster Theresa May has been plunged into turmoil with the resignation of two senior Cabinet ministers in a deep split over her Brexit strategy. The Foreign Secretary Boris Johnson, quit on Monday, hours after the resignation late on Sunday night of the minister in charge of Brexit negotiations, David Davis. Their decision to leave the government came three days after May appeared to have agreed a deal with her fractured Cabinet on the UK\u0027s post Brexit relationship with the EU. That plan is now in tatters and her political future appears uncertain. May appeared in Parliament on Monday afternoon to defend her plan, minutes after Downing Street confirmed the departure of Johnson. May acknowledged the splits in her statement to MPs, saying of the ministers who quit: We do not agree about the best way of delivering our shared commitment to honoring the result of the referendum. The Prime Minister\u0027s latest political drama began late on Sunday night when Davis quit, declaring he could not support May\u0027s Brexit plan. He said it involved too close a relationship with the EU and gave only an illusion of control being returned to the UK after it left the EU. It seems to me we\u0027re giving too much away, too easily, and that\u0027s a dangerous strategy at this time, Davis said in a BBC radio interview Monday morning. Johnson\u0027s resignation came Monday afternoon local time, just before the Prime Minister was due to make a scheduled statement in Parliament. This afternoon, the Prime Minister accepted the resignation of Boris Johnson as Foreign Secretary, a statement from Downing Street said.",
"language": "en"
},
{
"id": "2",
"text": "Microsoft fue fundado por Bill Gates y Paul Allen",
"language": "es"
}
]
}
},
"RequestBody": "{\u0022tasks\u0022: {\u0022entityRecognitionTasks\u0022: [], \u0022entityRecognitionPiiTasks\u0022: [], \u0022keyPhraseExtractionTasks\u0022: [], \u0022entityLinkingTasks\u0022: [], \u0022sentimentAnalysisTasks\u0022: [], \u0022extractiveSummarizationTasks\u0022: [{\u0022parameters\u0022: {\u0022stringIndexType\u0022: \u0022UnicodeCodePoint\u0022}, \u0022taskName\u0022: \u00220\u0022}], \u0022customEntityRecognitionTasks\u0022: [], \u0022customSingleClassificationTasks\u0022: [], \u0022customMultiClassificationTasks\u0022: []}, \u0022analysisInput\u0022: {\u0022documents\u0022: [{\u0022id\u0022: \u00221\u0022, \u0022text\u0022: \u0022The government of British Prime Minster Theresa May has been plunged into turmoil with the resignation of two senior Cabinet ministers in a deep split over her Brexit strategy. The Foreign Secretary Boris Johnson, quit on Monday, hours after the resignation late on Sunday night of the minister in charge of Brexit negotiations, David Davis. Their decision to leave the government came three days after May appeared to have agreed a deal with herfractured Cabinet on the UK\u0027s post Brexit relationship with the EU. That plan is now in tatters and her political future appears uncertain. May appeared in Parliament on Monday afternoon to defend her plan, minutes after Downing Street confirmed the departure of Johnson. May acknowledged the splits in her statement to MPs, saying of the ministers who quit: We do not agree about the best way of delivering our shared commitment to honoring the result of the referendum. The Prime Minister\u0027s latest plitical drama began late on Sunday night when Davis quit, declaring he could not support May\u0027s Brexit plan. He said it involved too close a relationship with the EU and gave only an illusion of control being returned to the UK after it left the EU. It seems to me we\u0027re giving too much away, too easily, and that\u0027s a dangerous strategy at this time, Davis said in a BBC radio interview Monday morning. Johnson\u0027s resignation came Monday afternoon local time, just before the Prime Minister was due to make a scheduled statement in Parliament. This afternoon, the Prime Minister accepted the resignation of Boris Johnson as Foreign Secretary, a statement from Downing Street said.\u0022, \u0022language\u0022: \u0022en\u0022}, {\u0022id\u0022: \u00222\u0022, \u0022text\u0022: \u0022Microsoft fue fundado por Bill Gates y Paul Allen\u0022, \u0022language\u0022: \u0022es\u0022}]}}",
"StatusCode": 202,
"ResponseHeaders": {
"apim-request-id": "a03b6b25-f013-4368-bd31-ad425c9179ac",
"Date": "Tue, 14 Dec 2021 18:53:37 GMT",
"operation-location": "https://fakeendpoint.cognitiveservices.azure.com/text/analytics/v3.2-preview.2/analyze/jobs/0a0d1391-60f6-4b43-8d4f-41abe9f6f861",
"apim-request-id": "45d67f8b-1922-42c0-a6d6-7190deabb9e7",
"Date": "Fri, 11 Feb 2022 22:24:52 GMT",
"operation-location": "https://fakeendpoint.cognitiveservices.azure.com/text/analytics/v3.2-preview.2/analyze/jobs/ffafe0bd-e704-47e3-806d-cdcbdcf27232",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
"Transfer-Encoding": "chunked",
"X-Content-Type-Options": "nosniff",
"x-envoy-upstream-service-time": "217"
"x-envoy-upstream-service-time": "149"
},
"ResponseBody": null
},
{
"RequestUri": "https://fakeendpoint.cognitiveservices.azure.com/text/analytics/v3.2-preview.2/analyze/jobs/0a0d1391-60f6-4b43-8d4f-41abe9f6f861?showStats=True",
"RequestUri": "https://fakeendpoint.cognitiveservices.azure.com/text/analytics/v3.2-preview.2/analyze/jobs/ffafe0bd-e704-47e3-806d-cdcbdcf27232?showStats=True",
"RequestMethod": "GET",
"RequestHeaders": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Connection": "keep-alive",
"User-Agent": "azsdk-python-ai-textanalytics/5.2.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0)",
"x-ms-client-request-id": "25293ed1-5d0f-11ec-aac3-b831b58100e8"
"x-ms-client-request-id": "6e622223-8b89-11ec-91fe-b831b58100e8"
},
"RequestBody": null,
"StatusCode": 200,
"ResponseHeaders": {
"apim-request-id": "3fa18449-f763-4f73-b925-eae5942bf462",
"apim-request-id": "107fe20e-9cdf-4723-8766-128bad85a9b3",
"Content-Type": "application/json; charset=utf-8",
"Date": "Tue, 14 Dec 2021 18:53:42 GMT",
"Date": "Fri, 11 Feb 2022 22:24:57 GMT",
"Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload",
"Transfer-Encoding": "chunked",
"X-Content-Type-Options": "nosniff",
"x-envoy-upstream-service-time": "114"
"x-envoy-upstream-service-time": "86"
},
"ResponseBody": {
"jobId": "0a0d1391-60f6-4b43-8d4f-41abe9f6f861",
"lastUpdateDateTime": "2021-12-14T18:53:41Z",
"createdDateTime": "2021-12-14T18:53:37Z",
"expirationDateTime": "2021-12-15T18:53:37Z",
"jobId": "ffafe0bd-e704-47e3-806d-cdcbdcf27232",
"lastUpdateDateTime": "2022-02-11T22:24:55Z",
"createdDateTime": "2022-02-11T22:24:52Z",
"expirationDateTime": "2022-02-12T22:24:52Z",
"status": "succeeded",
"errors": [],
"tasks": {
Expand All @@ -60,7 +93,7 @@
"total": 1,
"extractiveSummarizationTasks": [
{
"lastUpdateDateTime": "2021-12-14T18:53:41.3509318Z",
"lastUpdateDateTime": "2022-02-11T22:24:55.9540887Z",
"taskName": "0",
"state": "succeeded",
"results": {
Expand All @@ -74,7 +107,7 @@
{
"id": "1",
"statistics": {
"charactersCount": 1625,
"charactersCount": 1627,
"transactionsCount": 2
},
"sentences": [
Expand All @@ -91,10 +124,10 @@
"length": 164
},
{
"text": "Their decision to leave the government came three days after May appeared to have agreed a deal with herfractured Cabinet on the UK\u0027s post Brexit relationship with the EU.",
"rankScore": 0.47,
"text": "Their decision to leave the government came three days after May appeared to have agreed a deal with her fractured Cabinet on the UK\u0027s post Brexit relationship with the EU.",
"rankScore": 0.56,
"offset": 342,
"length": 171
"length": 172
}
],
"warnings": []
Expand Down
Loading

0 comments on commit 803e9e4

Please sign in to comment.