You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For samples on using the production recommended option `AnalyzeSentimentBatch` see [here][analyze_sentiment_sample].
161
163
164
+
To get more granular information about the opinions related to aspects of a product/service, also knows as Aspect-based Sentiment Analysis in Natural Language Processing (NLP), see sample on sentiment analysis with opinion mining [here][analyze_sentiment_opinion_mining_sample].
165
+
162
166
Please refer to the service documentation for a conceptual discussion of [sentiment analysis][sentiment_analysis].
163
167
164
168
### Extract Key Phrases
@@ -198,6 +202,26 @@ For samples on using the production recommended option `RecognizeEntitiesBatch`
198
202
199
203
Please refer to the service documentation for a conceptual discussion of [named entity recognition][named_entity_recognition].
200
204
205
+
### Recognize PII Entities
206
+
Run a predictive model to identify a collection of entities containing Personally Identifiable Information found in the passed-in document or batch of documents, and categorize those entities into categories such as US social security number, drivers license number, or credit card number.
207
+
208
+
```C# Snippet:RecognizePiiEntities
209
+
stringdocument="A developer with SSN 859-98-0987 whose phone number is 800-102-1100 is building tools with our APIs.";
For samples on using the production recommended option `RecognizePiiEntitiesBatch` see [here][recognize_pii_entities_sample].
222
+
223
+
Please refer to the service documentation for supported [PII entity types][pii_entity_type].
224
+
201
225
### Recognize Linked Entities
202
226
Run a predictive model to identify a collection of entities found in the passed-in document or batch of documents, and include information linking the entities to their corresponding entries in a well-known knowledge base.
203
227
@@ -307,7 +331,11 @@ Samples are provided for each main functional area, and for each area, samples a
Copy file name to clipboardExpand all lines: sdk/textanalytics/Azure.AI.TextAnalytics/samples/README.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,16 +16,21 @@ Azure Cognitive Services Text Analytics is a cloud service that provides advance
16
16
* Sentiment Analysis
17
17
* Key Phrase Extraction
18
18
* Named Entity Recognition
19
+
* Personally Identifiable Information (PII) Recognition
19
20
* Linked Entity Recognition
20
21
21
-
You can find samples for each of this main functions below, as well as a sample on how to create a mock client for testing purposes.
22
-
To get started you'll need a Text Analytics endpoint and credentials. See Text Analytics Client Library [Readme][README] for more information and instructions.
-[Analyze Sentiment with Opinion Mining](https://github.com/maririos/azure-sdk-for-net/blob/f781a29042bb26e3d9f28b66dd78ed9e8487c434/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample2.1_AnalyzeSentimentWithOpinionMining.md)
33
+
<!--- [Analyze Sentiment with Opinion Mining](https://github.com/Azure/azure-sdk-for-net/tree/master/sdk/textanalytics/Azure.AI.TextAnalytics/samples/Sample2.1_AnalyzeSentimentWithOpinionMining.md)-->
This sample demonstrates how to analyze sentiment of documents and get more granular information about the opinions related to aspects of a product/service, also knows as Aspect-based Sentiment Analysis in Natural Language Processing (NLP). This feature is only available for clients with api version v3.1-preview.1 and higher.
4
+
5
+
For the purpose of the sample, we will be the administrator of a hotel and we've set a system to look at the online reviews customers are posting to identify the major complaints about our hotel.
6
+
In order to do so, we will use the Sentiment Analysis feature of the Text Analytics client library. To get started you'll need a Text Analytics endpoint and credentials. See [README][README] for links and instructions.
7
+
8
+
## Creating a `TextAnalyticsClient`
9
+
10
+
To create a new `TextAnalyticsClient`, you need a Text Analytics endpoint and credentials. You can use the [DefaultAzureCredential][DefaultAzureCredential] to try a number of common authentication methods optimized for both running as a service and development. In the sample below, however, you'll use a Text Analytics API key credential by creating an `AzureKeyCredential` object, that if needed, will allow you to update the API key without creating a new client.
11
+
12
+
You can set `endpoint` and `apiKey` based on an environment variable, a configuration setting, or any way that works for your application.
To get a deeper analysis into which are the aspects that people considered good or bad, we will need to include the `AdditionalSentimentAnalyses.OpinionMining` type into the `AnalyzeSentimentOptions`.
21
+
22
+
```C# Snippet:TAAnalyzeSentimentWithOpinionMining
23
+
vardocuments=newList<string>
24
+
{
25
+
"The food and service were unacceptable, but the concierge were nice.",
26
+
"The rooms were beautiful. The AC was good and quiet.",
27
+
"The breakfast was good, but the toilet was smelly.",
28
+
"Loved this hotel - good breakfast - nice shuttle service - clean rooms.",
29
+
"I had a great unobstructed view of the Microsoft campus.",
30
+
"Nice rooms but bathrooms were old and the toilet was dirty when we arrived.",
To analyze the sentiment of a collection of documents in the same language, call `AnalyzeSentimentBatch` on an `IEnumerable` of strings. The results are returned as a `AnalyzeSentimentResultCollection`.
0 commit comments