This method automatically identifies and masks personal/sensitive data within a specific text.
- The ProtectoVault object is instantiated with your tokenization key.
- The input should consist of a list of values to be masked.
- The
maskmethod is used to automatically identify and mask personal/sensitive data within the provided text.
Note: To obtain the <auth token>, please refer to the Step-by-Step Guide to Obtain Your Auth Token.
Code Snippet
# Import the ProtectoVault class from the protecto_ai module
from protecto_ai import ProtectoVault
# Create an instance of ProtectoVault with your authentication token
obj = ProtectoVault("<auth_token>")
# Pass a list of sensitive information as input for the mask method
result = obj.mask(["George Washington is happy", "Mark lives in the U.S.A"])
# Print the masked result
print(result)
Result
{
"data": [
{
"value": "George Washington is happy",
"token_value": "<PER>hSw8kAEB10 748785848000</PER> is happy",
"toxicity_analysis": {
"toxicity": 0.0009287489,
"severe_toxicity": 0.00010670507,
"obscene": 0.000181875,
"threat": 0.00011947479,
"insult": 0.00016900127,
"identity_attack": 0.00014607343
},
"individual_tokens": [
{
"value": "George Washington",
"pii_type": "PERSON",
"token": "hSw8kAEB10 748785848000",
"prefix": "<PER>",
"suffix": "</PER>",
"start_pos": 0,
"end_pos": 17
}
]
},
{
"value": "Mark lives in the U.S.A",
"token_value": "<PER>14cJ0zWlmB</PER> lives in the <ADDRESS>IhMjRWU3LV.uvS0UzJEXs.Mc5RuPvtAn</ADDRESS>",
"toxicity_analysis": {
"toxicity": 0.0012568502,
"severe_toxicity": 0.00011042959,
"obscene": 0.00025225335,
"threat": 0.00009989677,
"insult": 0.0001859261,
"identity_attack": 0.0001574106
},
"individual_tokens": [
{
"value": "Mark",
"pii_type": "PERSON",
"token": "14cJ0zWlmB",
"prefix": "<PER>",
"suffix": "</PER>",
"start_pos": 0,
"end_pos": 4
},
{
"value": "U.S.A",
"pii_type": "GPE",
"token": "IhMjRWU3LV.uvS0UzJEXs.Mc5RuPvtAn",
"prefix": "<ADDRESS>",
"suffix": "</ADDRESS>",
"start_pos": 18,
"end_pos": 23
}
]
}
],
"success": true,
"error": {
"message": ""
}
}
We identify toxic content while masking. Click on ‘Identify Toxic Content‘ to learn more.
For more comprehensive information about our product, kindly reach out to us through our website at https://www.protecto.ai/.