Skip to content

kaveh-dev/paknevis.js

Repository files navigation

📃 paknevis.js

Paknevis.js is a npm package to detect or censor persian swears and bad words. Suitable for use in chat programs, comment sections, and entries where you want to be free of inappropriate text content.

🛠️ Examples

You can use it in both CommonJS and ESM modules:

import { Paknevis } from "paknevis";

Or

const { Paknevis } = require("paknevis");

Also you can use it in most modern browsers:

<script type="module">
    import { Paknevis } from 'public/js/paknevis/esm/paknevis.js';
    ...
</script>

Basic usage: You can find this file in examples/example.js .

const { Paknevis } = require('paknevis');

const text = "این یک فحش است : تخمی";

Paknevis.hasBadWords(text); // returns true.

Paknevis.censor(text); // returns "این یک فحش است"

With extra words:

const { Paknevis } = require('paknevis');

const text = "این یک فحش است : بازاری";

Paknevis.hasBadWords(text, ["بازاری"]); // returns true.

Paknevis.censor(text, ["بازاری"]); // returns "این یک فحش است"

With censor character:

const { Paknevis } = require('paknevis.js');

const text = "این یک فحش است : تخمی";

Paknevis.hasBadWords(text); // returns true.

Paknevis.censor(text, "*"); // returns "* این یک فحش است"

🚀 Testing

You can test code's functionality by jest package in Node.js.

npm run test

🤝 Contribution and development of code

Feel free to open an issue and contribute to the code, and if you like the code, give it a star!

About

Paknevis.js is a npm package to detect or censor persian swears and bad words.

Resources

License

Stars

Watchers

Forks

Packages

No packages published