pii-mask

buildCompromiseDetectors

Build NLP-powered person and place detectors.

Usage

import { createMasker } from '@pii-mask/core';
import { buildCompromiseDetectors } from '@pii-mask/nlp';

const nlpDetectors = buildCompromiseDetectors({
  entities: ['Person', 'Place'],
  confidence: 0.7,
});

const masker = createMasker({
  mode: 'mask',
  extend: nlpDetectors,
});

const { result } = masker.maskString('Emeka Okafor lives in Lagos');

Options

OptionTypeDefaultDescription
entitiesArray<'Person' | 'Place' | 'Organization'>['Person', 'Place']Entity types to detect
confidencenumber0.5Minimum confidence threshold
customLexiconRecord<string, string>{}Custom words to add to the NLP model

Try it in the browser ↗

On this page