Skip to content
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] add sample stories and improve documents #15429

Merged
merged 11 commits into from
Nov 18, 2020

Conversation

iscai-msft
Copy link
Contributor

@iscai-msft iscai-msft commented Nov 18, 2020

fixes #14509

…into sample_documents

* 'master' of https://github.com/Azure/azure-sdk-for-python: (225 commits)
  [text analtyics] add abby as codeowner (Azure#15376)
  test (Azure#15402)
  fix iothub version (Azure#15405)
  [T2] Batch (Azure#14757)
  [T2] Policyinsights (Azure#14794)
  [T2] apimanagement Wave3 (Azure#14804)
  [T2] devtestlabs Wave3 (Azure#14795)
  [T2]eventgrid wave3 (Azure#14805)
  [T2] Search (Azure#14823)
  test,version,CHANGELOG (Azure#14838)
  [T2]datalake-store Wave3 (Azure#14765)
  [T2] cdn 2020 11 15 (Azure#14952)
  [T2] security (Azure#14953)
  [T2] Relay (Azure#14968)
  [T2] Cognitiveservice (Azure#14977)
  [T2] advisor (Azure#14995)
  [T2] Marketplaceordering (Azure#15001)
  [T2]machinelearningservices wave3 (Azure#14726)
  test,version,CHANGELOG (Azure#14842)
  [T2] OperationsManagement (Azure#14950)
  ...
"""
Microsoft was founded by Bill Gates and Paul Allen. Its headquarters are located in Redmond. Redmond is a
city in King County, Washington, United States, located 15 miles east of Seattle.
""",
Copy link
Member

@kristapratico kristapratico Nov 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: the """ """ type string adds newlines to output

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, sorry. I added that to make it more clear this is a document visually. There are no print statements though, so I'm going to ignore your nit for now

"I need to take my cat to the veterinarian.",
"I will travel to South America in the summer."
"""
I need to take my cat to the veterinarian. He has been sick recently, and I need to take him
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😿

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so sorry

kristapratico
kristapratico previously approved these changes Nov 18, 2020
@iscai-msft iscai-msft marked this pull request as ready for review November 18, 2020 22:14
Copy link
Member

@kristapratico kristapratico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

{"id": "0", "language": "en", "text": "I had the best day of my life."},
{"id": "1", "language": "en",
{"id": "0", "country_hint": "US", "text": "I had the best day of my life. I decided to go sky-diving and it made me appreciate my whole life so much more. I developed a deep-connection with my instructor as well."},
{"id": "1", "country_hint": "GB",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious, why in some cases the whole object is in one line, and in some it is divided? I can't find the pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For dicts idk if it would work to have it on multiple lines, I'm not sure how it would render. Otherwise, I try to make it as document-like as possible. In cases where I have to print the document, I can't make it as document-like as possible, since that format introduces whitespace that looks weird when printed

if not any_sentence_not_positive:
positive_reviews_final.append(review)

print("We now have the final list of positive reviews we are going to display on our website!")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol, great imagination :)

Comment on lines +71 to +75
"""
The food and service were unacceptable, but the concierge were nice.
After talking to them about the quality of the food and the process to get room service they refunded
the money we spent at the restaurant and gave us a voucher for near by restaurants.
""",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the format in this sample as it is clear where each document starts and ends. Could you apply it in other places i.e. recognize_entities_azync?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having it like this introduces whitespace that looks weird printed, so I only have it like this in samples where the documents themselves won't be printed

print(
"In this sample we own a hotel with customers from all around the globe. We want to eventually "
"translate these reviews into English so our manager can read them. However, we first need to know which language "
"they are in for more accurate translation. This is the step we will be covering in this sample\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think it is worth saying something like

Note: translation is not covered in this sample

or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's ok, since detect_language just detects language, so I don't think users would expect the sample to do translation. I also mention that this sample only covers detecting a language

walking up the stairs :). Can't say enough good things about my experience!
""",
"""
最近由于工作压力太大,我们决定去富酒店度假。那儿的温泉实在太舒服了,我跟我丈夫都完全恢复了工作前的青春精神!加油!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious, what it says :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had a lot of pressure at work recently, so I've decided to go to Foo Hotel (I went with a chinese character that sounded like Foo, and means wealth) for a holiday. Their spa is so comfortable, my husband and I both recovered our pre-work energy

Copy link
Member

@maririos maririos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the ideas!!!

@iscai-msft iscai-msft merged commit 9f4e92b into Azure:master Nov 18, 2020
iscai-msft added a commit that referenced this pull request Nov 19, 2020
…into feature/textanalytics5.2

* 'master' of https://github.com/Azure/azure-sdk-for-python: (40 commits)
  Sync eng/common directory with azure-sdk-tools for PR 1203 (#15441)
  [ServiceBus] Graceful noops for methods taking empty lists. (#15286)
  [text analytics] add sample stories and improve documents (#15429)
  [ServiceBus] Enable FQDNs and connection strings to support newlines and protocol prefixing (e.g. sb://) (#15212)
  Fix combined session+auto-auto_lock_renewer+receive-and-delete mode issue where registry would fail during receipt.  Add tests and changelog entry. (#15343)
  Add Update-python-CIConfig (#15379)
  Remove aiodns from our CI (#15424)
  Resolve Broken Portal Link (#15431)
  [Key Vault] Update tests which disable soft-delete (#15352)
  switching order on readme (#15426)
  [text analtyics] add abby as codeowner (#15376)
  test (#15402)
  fix iothub version (#15405)
  [T2] Batch (#14757)
  [T2] Policyinsights (#14794)
  [T2] apimanagement Wave3 (#14804)
  [T2] devtestlabs Wave3 (#14795)
  [T2]eventgrid wave3 (#14805)
  [T2] Search (#14823)
  test,version,CHANGELOG (#14838)
  ...
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this pull request Aug 6, 2021
[Hub Generated] Review request for description changes under maps/data-plane/Route & Search (Azure#15429)

* Merge changes in PR:14813

* Merge changes in PR:14829

* Merge changes in PR:14965

Co-authored-by: Alan Yang <pochingyang@microsoft.com>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this pull request Aug 6, 2021
[Hub Generated] Review request for description changes under maps/data-plane/Route & Search (Azure#15429)

* Merge changes in PR:14813

* Merge changes in PR:14829

* Merge changes in PR:14965

Co-authored-by: Alan Yang <pochingyang@microsoft.com>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this pull request Aug 6, 2021
[Hub Generated] Review request for description changes under maps/data-plane/Route & Search (Azure#15429)

* Merge changes in PR:14813

* Merge changes in PR:14829

* Merge changes in PR:14965

Co-authored-by: Alan Yang <pochingyang@microsoft.com>
openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-python that referenced this pull request Aug 6, 2021
[Hub Generated] Review request for description changes under maps/data-plane/Route & Search (Azure#15429)

* Merge changes in PR:14813

* Merge changes in PR:14829

* Merge changes in PR:14965

Co-authored-by: Alan Yang <pochingyang@microsoft.com>
@iscai-msft iscai-msft deleted the sample_documents branch September 10, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[text analytics] make each document in OM sample longer, and have less
3 participants