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
Copy file name to clipboardExpand all lines: articles/synapse-analytics/machine-learning/tutorial-text-analytics-use-mmlspark.md
+9-136Lines changed: 9 additions & 136 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,39 +54,6 @@ cognitive_service_name = "<Your linked service for text analytics>"
54
54
## Text Sentiment
55
55
The Text Sentiment Analysis provides a way for detecting the sentiment labels (such as "negative", "neutral" and "positive") and confidence scores at the sentence and document-level. See the [Supported languages in Text Analytics API](../../cognitive-services/text-analytics/language-support.md?tabs=sentiment-analysis) for the list of enabled languages.
56
56
57
-
### V2
58
-
59
-
```python
60
-
61
-
# Create a dataframe that's tied to it's column names
62
-
df = spark.createDataFrame([
63
-
("I am so happy today, its sunny!", "en-US"),
64
-
("I am frustrated by this rush hour traffic", "en-US"),
65
-
("The cognitive services on spark aint bad", "en-US"),
66
-
], ["text", "language"])
67
-
68
-
# Run the Text Analytics service with options
69
-
sentimentv2 = (TextSentimentV2()
70
-
.setLinkedService(linked_service_name)
71
-
.setTextCol("text")
72
-
.setOutputCol("sentiment")
73
-
.setErrorCol("error")
74
-
.setLanguageCol("language"))
75
-
76
-
# Show the results of your text query in a table format
The Language Detector evaluates text input for each document and returns language identifiers with a score that indicates the strength of the analysis. This capability is useful for content stores that collect arbitrary text, where language is unknown. See the [Supported languages in Text Analytics API](../../cognitive-services/text-analytics/language-support.md?tabs=language-detection) for the list of enabled languages.
124
95
125
-
### V2
126
-
```python
127
-
# Create a dataframe that's tied to it's column names
128
-
df = spark.createDataFrame([
129
-
("Hello World",),
130
-
("Bonjour tout le monde",),
131
-
("La carretera estaba atascada. Había mucho tráfico el día de ayer.",),
132
-
("你好",),
133
-
("こんにちは",),
134
-
(":) :( :D",)
135
-
], ["text",])
136
-
137
-
# Run the Text Analytics service with options
138
-
languagev2 = (LanguageDetectorV2()
139
-
.setLinkedService(linked_service_name)
140
-
.setTextCol("text")
141
-
.setOutputCol("language")
142
-
.setErrorCol("error"))
143
-
144
-
# Show the results of your text query in a table format
145
-
display(languagev2.transform(df))
146
-
```
147
-
### Expected results
148
-

149
-
150
-
### V3.1
151
96
```python
152
97
# Create a dataframe that's tied to it's column names
The Entity Detector returns a list of recognized entities with links to a well-known knowledge base. See the [Supported languages in Text Analytics API](../../cognitive-services/text-analytics/language-support.md?tabs=entity-linking) for the list of enabled languages.
178
123
179
-
### V2
180
-
181
-
```python
182
-
df = spark.createDataFrame([
183
-
("1", "Microsoft released Windows 10"),
184
-
("2", "In 1975, Bill Gates III and Paul Allen founded the company.")
The Key Phrase Extraction evaluates unstructured text and returns a list of key phrases. This capability is useful if you need to quickly identify the main points in a collection of documents. See the [Supported languages in Text Analytics API](../../cognitive-services/text-analytics/language-support.md?tabs=key-phrase-extraction) for the list of enabled languages.
223
146
224
-
### V2
225
-
```python
226
-
df = spark.createDataFrame([
227
-
("en", "Hello world. This is some input text that I love."),
228
-
("fr", "Bonjour tout le monde"),
229
-
("es", "La carretera estaba atascada. Había mucho tráfico el día de ayer.")
Named Entity Recognition (NER) is the ability to identify different entities in text and categorize them into pre-defined classes or types such as: person, location, event, product, and organization. See the [Supported languages in Text Analytics API](../../cognitive-services/text-analytics/language-support.md?tabs=named-entity-recognition) for the list of enabled languages.
281
176
282
-
### V2
283
-
```python
284
-
df = spark.createDataFrame([
285
-
("1", "en", "I had a wonderful trip to Seattle last week."),
The PII feature is part of NER and it can identify and redact sensitive entities in text that are associated with an individual person such as: phone number, email address, mailing address, passport number. See the [Supported languages in Text Analytics API](../../cognitive-services/text-analytics/language-support.md?tabs=pii) for the list of enabled languages.
0 commit comments