Metadata-Version: 2.1
Name: magic_profanity
Version: 1.1.0
Summary: A Python library for detecting and censoring profanity in text
Home-page: https://github.com/Kabhishek18/magic_profanity
Author: Kumar Abhishek
Author-email: developer@kabhishek18.com
Keywords: profanity-filter censorship text-processing
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# Magic Profanity

`magic_profanity` is a Python library for detecting and censoring profanity in text using customizable word lists and character mappings. It support English and Hinglish

## Installation

You can install `magic_profanity` using pip:

```python
pip install ProfanityFilter
```

## Requirements

- `Python 3+`

## Usage

### Importing the Library

```python
from magic_profanity import ProfanityFilter
```
### Initializing the Profanity Filter

#### Create an instance of MagicProfanity:
```python
profanity_filter = ProfanityFilter()
```

### Loading Custom Words
You can load custom words into the profanity filter either from a list or from a file:

### Load words from a list
```python
profanity_filter.load_words(["badword1", "badword2"])
```
### Load words from a file
```python
profanity_filter.load_words_from_file("path/to/custom_wordlist.txt")
```
### Load Custom Words
 Only accepts list, tuple, or set.
```python
profanity_filter.add_custom_words(["badword1", "badword2"])
```

Checking for Profanity
You can check if a text contains profanity using contains_profanity:

```python
text = "This sentence contains a badword1 and a BadWord2."
if profanity_filter.has_profanity(text):
    print("Profanity detected!")
else:
    print("No profanity found.")
```    

### Censoring Text
You can censor profanity in text using censor:

```python 
censored_text = profanity_filter.censor_text(text)
print(censored_text)
```

### Adding Custom Words
You can add custom words to the profanity filter:

```python 
profanity_filter.add_censor_words(["newbadword1", "newbadword2"])
```

### Custom Character Mappings
You can customize character mappings used for censoring:

```python
profanity_filter.char_map = {
    "a": ("a", "@", "*", "4"),
    "i": ("i", "*", "l", "1"),
    "o": ("o", "*", "0", "@"),
    # Add more mappings as needed
}
```

#Contributing
Contributions are welcome! If you have any suggestions, bug reports, or enhancements, please open an issue or a pull request on GitHub.

#License
This project is licensed under the MIT License - see the LICENSE file for details.




