profanity-filter | Python library | Natural Language Processing library
kandi X-RAY | profanity-filter Summary
kandi X-RAY | profanity-filter Summary
profanity-filter is a universal library for detecting and filtering profanity. Support for English and Russian is included.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Configures the model
- Set the language
- Load profane word dictionaries
- Update the languages_str attribute
- Clears the cache
- Update the profane_word_dictionaries
- Clear the censored words cache
- Returns a spacy profanity filter component
- Return the language for the given language
- Create a token from a word
- Parse a spacy text
- Returns a dictionary of profane words
- Load all profane words
- Set spacy filter
- Set the custom_profane_word dictionary
- Set the extra_profane_word_dictionary
- Set spell classes
- Set the censor character
- Create a new profile filter
- Set the morphological analysis
profanity-filter Key Features
profanity-filter Examples and Code Snippets
from profanity_filter import ProfanityFilter
pf = ProfanityFilter()
pf.censor_char = '@'
pf.censor("That's bullshit!")
# "That's @@@@@@@@!"
pf.censor_char = '*'
pf.custom_profane_word_dictionaries = {'en': {'love', 'dog'}}
pf.censor("I love dogs a
import spacy
from profanity_filter import ProfanityFilter
nlp = spacy.load('en')
profanity_filter = ProfanityFilter(nlps={'en': nlp}) # reuse spacy Language (optional)
nlp.add_pipe(profanity_filter.spacy_component, last=True)
doc = nlp('This is sh
$ profanity_filter -h
usage: profanity_filter [-h] [-t TEXT | -f PATH] [-l LANGUAGES] [-o OUTPUT_FILE] [--show]
Profanity filter console utility
optional arguments:
-h, --help show this help message and exit
-t TEXT, --text TEXT Tes
Community Discussions
Trending Discussions on profanity-filter
QUESTION
I need the Spacy model 'en' for the Python profanity-filter. I would like to have a requirements.txt
file that installs everything needed. I have the following:
ANSWER
Answered 2021-Nov-01 at 04:47You can't fix this in requirements.txt
. Making the shortcut en
work for the model en_core_web_sm
isn't a property of the installed package, it's something spaCy manages separately. The shortcut process relies on symbolic links and is kind of flaky, which is why it was removed in v3.
Since it looks like the profanity filter package is abandoned, your options are running spacy link
from the command line or modifying the profanity filter package yourself.
You could also figure out what spacy link
is doing and do that (or call the relevant functions) in code.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install profanity-filter
For minimal setup you need to install profanity-filter with is bundled with spacy and download spacy model for tokenization and lemmatization:. For more info about Spacy models read: https://spacy.io/usage/models/.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page