This repository provides a Python script to remove cuss words from a given text using the better_profanity
package.
To use this script, you need to install the better_profanity
package. You can do this using pip:
pip install better_profanity
Here's an example of how to use the script to remove cuss words from a text file:
from better_profanity import profanity
# Initialize the profanity filter
profanity.load_censor_words()
# Function to remove cuss words from text
def remove_cuss_words(text):
return profanity.censor(text)
# Example usage
if __name__ == "__main__":
text = "This is a damn example text with some cuss words."
clean_text = remove_cuss_words(text)
print(clean_text) # Output: This is a **** example text with some **** words.
Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.
This project is licensed under the MIT License.