Anonymize

Removes Personally Identifiable Information (PII) from the input text. Generates a new output.

The names of the suspects are JOHN SMITH *** and Terra McDonald ***. You can reach their lawyer at [email protected] ***.

πŸ“˜

Use Anonymize Skill to anonymize:

πŸ‘

Benchmarks

Coming soon...

Output labels

TypeValue
anonymizedThe anonymized text

Parameters

None.

Example

Request

curl -X POST \
'https://api.oneai.com/api/v0/pipeline' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'api-key: <YOUR_API_KEY_HERE>' \
-d '{
    "input": "The name of the suspects are John Smith and Terra McDonald. You can reach their lawyer at [email protected]",
    "steps": [
      {
        "skill": "anonymize"
      }   
    ]
}'
const { OneAI } = require("oneai");
const oneai = new OneAI("<YOUR-API-KEY-HERE>")

const text =
  "The name of the suspects are John Smith and Terra McDonald. You can reach their lawyer at [email protected]";
const pipeline = new oneai.Pipeline(oneai.skills.anonymize());

pipeline
  .run(text)
  .then((o) => console.log(o))
  .catch(console.error);
import oneai

oneai.api_key = "<YOUR-API-KEY-HERE>"
text = "The name of the suspects are John Smith and Terra McDonald. You can reach their lawyer at [email protected]"
pipeline = oneai.Pipeline(
  steps = [
        oneai.skills.Anonymize(),
  ]
)

output = pipeline.run(text)

Response

{
  "input_text": "The name of the suspects are John Smith and Terra McDonald. You can reach their lawyer at [email protected]",
  "status": "success",
  "output": [
    {
      "text_generated_by_step_name": "anonymize",
      "text_generated_by_step_id": 1,
      "text": "The name of the suspects are *** and ***. You can reach their lawyer at ***",
      "labels": [
        {
          "type": "anonymized",
          "skill": "anonymize",
          "value": "John Smith",
          "span_text": "John Smith",
          "span": [
            29,
            32
          ],
          "output_spans": [
            {
              "section": 0,
              "start": 29,
              "end": 32
            }
          ]
        },
        {
          "type": "anonymized",
          "skill": "anonymize",
          "value": "Terra McDonald",
          "span_text": "Terra McDonald",
          "span": [
            37,
            40
          ],
          "output_spans": [
            {
              "section": 0,
              "start": 37,
              "end": 40
            }
          ]
        },
        {
          "type": "anonymized",
          "skill": "anonymize",
          "value": "[email protected]",
          "span_text": "[email protected]",
          "span": [
            72,
            75
          ],
          "output_spans": [
            {
              "section": 0,
              "start": 72,
              "end": 75
            }
          ]
        }
      ]
    }
  ],
  "stats": {
    "concurrency_wait_time": 0,
    "total_running_jobs": 1,
    "total_waiting_jobs": 0
  }
}
{
  text: 'The name of the suspects are John Smith and Terra McDonald. You can reach their lawyer at [email protected]',
  anonymizations: {
    text: 'The name of the suspects are *** and ***. You can reach their lawyer at ***'
  }
}