Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
anonymize-nlp
Advanced tools
Anonymize-NLP is a lightweight and robust package for text anonymization. It uses Natural Language Processing (NLP) and Regular Expressions (Regex) to identify and mask sensitive information in a string.,
Anonymize-NLP is a lightweight and robust package for text anonymization. It uses Natural Language Processing (NLP) and Regular Expressions (Regex) to identify and mask sensitive information in a string.
Install Anonymize-NLP and its peer dependencies with npm.
npm i anonymize-nlp
import { AnonymizeNlp } from 'anonymizenlp';
const anonymizer = new AnonymizeNlp();
const anonymizedText = anonymizer.anonymize(`Hi I'm John Doe, my email is john@example.com and my phone number is +1-234-567-8900.`);
console.log(anonymizedText);
// Output: "Hi I'm <FIRSTNAME> <LASTNAME>, my email is <EMAIL> and my phone number is <PHONENUMBER>."
const originalText = anonymizer.deAnonymize(anonymizedText);
console.log(originalText);
// Output: "Hi I'm John Doe, my email is john@example.com and my phone number is +1-234-567-8900."
By default, all types are anonymized.
constructor(typesToAnonymize: AnonymizeType[] = anonymizeTypeOptions, typesToExclude: AnonymizeType[] = [])
typesToAnonymize
: Array of AnonymizeType
that you want to anonymize in the text.typesToExclude
: Array of AnonymizeType
that you want to exclude from anonymization.type AnonymizeType =
| 'date'
| 'email'
| 'firstname'
| 'lastname'
| 'money'
| 'organization'
| 'phonenumber'
| 'time'
| 'creditcard'
| 'domain'
| 'ip'
| 'token'
| 'url'
| 'id'
| 'zip_code'
| 'crypto'
| 'apikey';
Anonymizes the specified categories in the given text.
input
: The text to be anonymized.Reverts the anonymized text back to its original form.
input
: The anonymized text.Contributions to this project are welcome! If you would like to contribute, please follow these steps:
Please ensure that your code follows the project's coding style and that all tests pass before submitting a pull request. If you find any bugs or have suggestions for improvements, feel free to open an issue on GitHub.
This project is licensed under the MIT License. See the LICENSE file for the full license text.
Copyright (c) 2023. All rights reserved.
FAQs
Anonymize-NLP is a lightweight and robust package for text anonymization. It uses Natural Language Processing (NLP) and Regular Expressions (Regex) to identify and mask sensitive information in a string.,
The npm package anonymize-nlp receives a total of 5,023 weekly downloads. As such, anonymize-nlp popularity was classified as popular.
We found that anonymize-nlp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.