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
> * NER includes separate methods for detecting personal information.
243
+
> In version `3.0-preview`:
245
244
> * Entity linking is a separate request than NER.
246
245
247
246
Create a new function called `entity_recognition_example` that takes the client as an argument, then calls the `recognize_entities()` function and iterates through the results. The returned response object will contain the list of detected entities in `entity` if successful, and an `error` if not. For each detected entity, print its Category and Sub-Category if exists.
@@ -250,13 +249,13 @@ Create a new function called `entity_recognition_example` that takes the client
250
249
defentity_recognition_example(client):
251
250
252
251
try:
253
-
document= ["I had a wonderful trip to Seattle last week."]
254
-
result = client.recognize_entities(inputs= document)[0]
252
+
documents= ["I had a wonderful trip to Seattle last week."]
253
+
result = client.recognize_entities(documents= documents)[0]
Create a new function called `entity_pii_example()` that takes the client as an argument, then calls the `recognize_pii_entities()` function and gets the result. Then iterate through the results and print the entities.
281
-
282
-
```python
283
-
defentity_pii_example(client):
284
-
285
-
document = ["Insurance policy for SSN on file 123-12-1234 is here by approved."]
286
-
287
-
288
-
result = client.recognize_pii_entities(inputs= document)[0]
289
-
290
-
print("Personally Identifiable Information Entities: ")
Text: 123-12-1234 Category: U.S. Social Security Number (SSN) SubCategory: None
303
-
Length: 11 Score: 0.85
304
-
```
305
-
306
-
307
277
## Entity Linking
308
278
309
279
Create a new function called `entity_linking_example()` that takes the client as an argument, then calls the `recognize_linked_entities()` function and iterates through the results. The returned response object will contain the list of detected entities in `entities` if successful, and an `error` if not. Since linked entities are uniquely identified, occurrences of the same entity are grouped under a `entity` object as a list of `match` objects.
@@ -312,12 +282,12 @@ Create a new function called `entity_linking_example()` that takes the client as
312
282
defentity_linking_example(client):
313
283
314
284
try:
315
-
document= ["""Microsoft was founded by Bill Gates and Paul Allen on April 4, 1975,
285
+
documents= ["""Microsoft was founded by Bill Gates and Paul Allen on April 4, 1975,
316
286
to develop and sell BASIC interpreters for the Altair 8800.
317
287
During his career at Microsoft, Gates held the positions of chairman,
318
288
chief executive officer, president and chief software architect,
319
289
while also being the largest individual shareholder until May 2014."""]
320
-
result = client.recognize_linked_entities(inputs= document)[0]
290
+
result = client.recognize_linked_entities(documents= documents)[0]
0 commit comments