npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

uncensor

v1.0.0

Published

Fill in censored words with their corresponding profanities.

Downloads

8

Readme

Uncensor*

This module is created for the purposes of unmasking censored strings such as "f**k".

But Why?

In our web-tracking tasks, we often come across statements like "That C.E.O is a p***k!". Now if you have to run sentiment analysis on this post, or even for the purposes of appropriately saving it in a full text data-store (we love elasticsearch), you must first decode what p***k stands for. This is what we call "Uncensoring"!

I'm sure there are many other use cases for this. Now that a divisive U.S. election has churned out a lot of curse words into the interwebs!

Enough Politics. Let's Dive In!

It is easy to use uncensor. Install from npm npm install --save uncensor

const uncensor = require('uncensor');

var masked = "f**k";
var unmasked = uncensor.unmask(masked);

console.log(unmasked);

This prints out:

{
    "censored": "f**k",
    "results": {
        "word": {
            "profanity": "fuck",
            "popularity": 9
        },
        "other_words": [
            {
                "profanity": "fook",
                "popularity": 0
            },
            {
                "profanity": "feck",
                "popularity": 0
            }
        ],
        "meta": {
            "count": 3,
            "steps": "Length Check > Start Letter Match > Last Letter Match > Levenshtein Ordering [3 words]"
        }
    }
}

Note that results include a meta object that indicates the steps taken to arrive at results presented.

  • Length Check : results filtered by length of mask.

  • Start Letter Match & Last Letter Match : masked words usually indicate the start & last letters. So we further filter the results by those letters.

  • Levenshtein Ordering : We then use levenshtein distance & profanity popularity to sort out results where multiple results are returned.

Dealing With Phrases

You can also unmask entire phrases.

const uncensor = require('uncensor');

var masked_phrase = "That guy is such a p***y. Hate the m*****fckuer!";
var unmasked_phrase = uncensor.unmask_phrase(masked_phrase);

console.log(unmasked_phrase);

//PRINTS: That guy is such a pussy. Hate the motherfucker!

Run the Tests...

You can run tests folder for some of the tests.