CofeehousePy/services/spam_detection
Netkas 3294bc4ea6 Added NSFW classification 2021-01-14 02:07:24 -05:00
..
coffeehouse_spamdetection Added experimental translation services 2020-12-30 21:41:37 -05:00
MANIFEST.in Added SpamDetection 2020-12-27 23:08:53 -05:00
README.md Added NSFW classification 2021-01-14 02:07:24 -05:00
requirements.txt Added SpamDetection 2020-12-27 23:08:53 -05:00
setup.py Added NSFW classification 2021-01-14 02:07:24 -05:00

README.md

CoffeeHouse SpamDetection

Library for detecting spam by classifying input as spam/ham

Installation

Install the following packages using the corresponding setup and makefile operations provided by the repo, or use CoffeeHouse-Server's install script to install all the required components

  • Hyper-Internal-Service
  • CoffeeHouse-NLPFR
  • CoffeeHouse-DLTC
  • CoffeeHouseMod-Tokenizer
  • CoffeeHouseMod-StopWords
  • CoffeeHouseMod-APT

Finally, install CoffeeHouse-SpamDetection by running python3 setup.py install

Build Model

You can update the model build by adding new data to .dat files located in model/spam_ham/ then proceed to build the model by running ./build_model. This process will product a directory called spam_ham_build which you should copy over to coffeehouse_spamdetection/ and replace the already existing files. This process is resource intensive so make sure you are running this operation on supported chipsets that were manufactured after 2014.

Example Usage

from coffeehouse_spamdetection.main import SpamDetection

spam_detection = SpamDetection()
spam_detection.predict("Test")
# {'ham': 0.998092, 'spam': 0.0017609089}

Start as server

python3 -m coffeehouse_spamdetection --start-server

This process will run using port 5601 and only accepts POST requests with the parameter input as plain text. You should recieve a JSON response that looks like this

{
  "status": true,
  "results": {
    "ham": "0.998092",
    "spam": "0.0017609089"
  }
}