Git Product home page Git Product logo

bad-words-detector's Introduction

bad-words-detector

A Python script to detect language of text and filter out the BAD words

I came across one requirement where I was given a large text, say an article, and the task was to filter out any abusive or bad words in that piece of text. Another difficulty of this problem was that the language of the text was not known. The article could have been written in English, Spanish, French or German.

bad-words-detector.py is a Python script that uses the Natural Language Toolkit(NLTK) library to solve the above problem statement.
The problem was divided into below three phases :
1. Detect the language of the text
2. Fetch bad/abusive words for the language detected
3. Output the bad words in each line of the text

Language detection can be achieved by using the stopwords function as provided by the Python's nltk library.
Datasets containing the most common bad words in each of the 4 languages - English, Spanish, French and German are attached.

To run this script, you will need to install the nltk library, if you do not have it installed already.

pip install nltk

Place all your text in one file and run the script. Pass on the complete name of your file containing the text to the script(as given below) and it will detect and show you the bad words in each line.

>> python bad-words-detector.py "test-files/test-english.txt"

bad-words-detector's People

Contributors

ani10030 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bad-words-detector's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.