JSPM

persian-swear-words

1.6.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q51557F
  • License MIT

unwanted content. Wordlist is available in JSON format and there is also a helper function written in JavaScript to assist you how to use this datas.

Package Exports

  • persian-swear-words
  • persian-swear-words/PersianSwear.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (persian-swear-words) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Persian-Swear-Words

Persian (Farsi) Swear Words + .json Datasets

  • Author: Amir Shokri
  • Author Email: amirsh.nll@gmail.com
  • Last Update: 11 October, 2021
  • Data format: JSON Data
  • Functions Availabe :
    • PHP
    • Python
    • Javascript
  • Contribute: Fork and Push Requests :)
  • DOI : 10.34740/kaggle/dsv/2094967

Note: This is a to-be-complete list of Persian Swears you can use in your production to filter unwanted content. Wordlist is available in JSON format.

یادداشت ها:

برخی از کلمات در ظاهر کلمات بد به حساب نمیان ولی برای کاربردهای خاص ممکنه نیاز به فیلتر شدن داشته باشن که هر کس با توجه به نیاز باید شخصی سازی انجام بده و از این دیتاست استفاده کنه

در صورت علاقه، به تکمیل شدن این دیتاست کمک کنید

از این دیتاست در فیلتر کردن متن ها در پروژه های خود استفاده کنید و متون پاک و سالمی را داشته باشید

از ارسال PR های کوچک خودداری کنید و مشارکت مفیدتری داشته باشید.

به جز مشارکت در دیتاست می توانید به زبان برنامه نویسی مورد نظر خودتان class یا function با کمک این دیتاست بنویسید و به پروژه اضافه کنید. در حال حاضر توابع مربوط به زبان های زیر موجود است:

  • PHP
  • Python
  • Javascript
  • C#

Installation

composer

composer require amirshnll/persian-swear-words

npm

npm i persian-swear-words

Usage

PHP 🔗 Class

require('PersianSwear.php');
$persianswear = new PersianSwear();

// is bad
if($persianswear->is_bad('خر'))
    echo 'is bad';
else
    echo 'not bad';

// not bad
if($persianswear->is_bad('امروز'))
    echo 'is bad';
else
    echo 'not bad';

// not bad
if($persianswear->is_bad('چرت و پرت'))
    echo 'is bad';
else
    echo 'not bad';

$persianswear->add_word('چرت و پرت');
// is bad

if($persianswear->is_bad('چرت و پرت'))
    echo 'is bad';
else
    echo 'not bad';

// is bad
if($persianswear->is_bad('گاو'))
    echo 'is bad';
else
    echo 'not bad';

$persianswear->remove_word('گاو');

// not bad
if($persianswear->is_bad('گاو'))
    echo 'is bad';
else
    echo 'not bad';

// not bad
if($persianswear->has_swear('تو دوست من هستی'))
    echo 'is bad';
else
    echo 'not bad';

// is bad
if($persianswear->has_swear('تو هیز هستی'))
    echo 'is bad';
else
    echo 'not bad';

echo $persianswear->filter_words('تو دوست من هستی'); // تو دوست من هستی 
echo $persianswear->filter_words('تو هیز هستی'); // تو * هستی 
echo $persianswear->filter_words('تو هیز هستی', "&"); // تو & هستی 

echo $persianswear->tostring(); // show all swear words

Python 🔗 Class

persianswear = PersianSwear()

print(persianswear.is_bad(,'خر',ignoreOT=False )) # True

print(persianswear.is_bad('امروز',ignoreOT=False )) # False

print(persianswear.is_bad('چرت و پرت',ignoreOT=False )) # False

persianswear.add_word('چرت و پرت')
print(persianswear.is_bad('چرت و پرت' , ignoreOT=False )) # True

print(persianswear.has_swear('تو دوست من هستی' , ignoreOT=False )) # False

print(persianswear.has_swear('تو هیز هستی' , ignoreOT=False )) # True

print(persianswear.filter_words('تو دوست من هستی' , ignoreOT=False )) # تو دوست من هستی

print(persianswear.filter_words('تو هیز هستی' , ignoreOT=False )) # تو * هستی

print(persianswear.filter_words('تو هیز هستی', '&' , ignoreOT=False )) # تو & هستی


print(persianswear.is_bad('خ.ر' , ignoreOT=True )) # True

print(persianswear.is_bad( 'ام.روز' , ignoreOT=True )) # False

print(persianswear.has_swear('تو دو.ست من هستی' , ignoreOT=True )) # False

print(persianswear.has_swear('تو اسک.ل هستی' , ignoreOT=True )) # True

print(persianswear.filter_words('تو دو.ست من هستی',ignoreOT=True )) # تو دو.ست من هستی

print(persianswear.filter_words('تو هی.ز هستی',ignoreOT=True )) # تو * هستی

print(persianswear.filter_words('تو هی.ز هس.تی' , ignoreOT=True )) # تو * هس.تی

print(persianswear.tostring()) # show all swear words

Javascript 🔗 Function

console.log(PersianSwear.is_bad('خر')); // true
console.log(PersianSwear.is_bad('امروز')); // false

console.log(PersianSwear.is_bad('چرت و پرت')); // false
PersianSwear.add_word('چرت و پرت');
console.log(PersianSwear.is_bad('چرت و پرت')); // true

console.log(PersianSwear.is_bad('گاو')); // true
PersianSwear.remove_word('گاو');
console.log(PersianSwear.is_bad('گاو')); // false

console.log(PersianSwear.has_swear('تو دوست من هستی')); // false
console.log(PersianSwear.has_swear('تو هیز هستی')); // true

console.log(PersianSwear.filter_words('تو دوست من هستی')); // تو دوست من هستی 
console.log(PersianSwear.filter_words('تو هیز هستی')); // تو * هستی 
console.log(PersianSwear.filter_words('تو هیز هستی', '&')); // تو & هستی 

C# 🔗 Helper

Create Filter

First of All You Need To Create Instance of FilterPersianWords

var filter = new FilterPersianWords();

if you have any optional json file path you can pass it down to constructor.

Use Functions

  • Is a single word bad?

var isBadWord = filter.IsBadWord("yourWord");

  • Is a multi line string bad?

    var isBadSentence = filter.IsBadSentence("your long sentence");

  • Get all bad words inside of string

    var badList = filter.GetBadWords("your long sentence");

  • Remove All Bad words From String

    var clearedString = filter.RemoveBadWords("your bad sentence");

    This Method Will not change any data from string except the bad words.



از این دیتاست و کلمات این دیتاست می توانید برای فیلتر کردن کامنت ها و پیام های اینستاگرامتون هم استفاده کنید:

https://youtu.be/8YNCmrB5Y0M



Donate (BTC Address) : 188GPtyoyz2LXXxbyWcCrDgUM7ejSHHgZd

Donate (Ethereum Address) : 0x2a77dAB50D76A2aE0A3A7572Ee2Fc34d5F94b3dB


Other datasets collected by me