<commit_before>=========
spicedham
=========

Spam filter library developed for input
--------

:Code:         https://github.com/mozilla/spicedham/
:Issues:       https://github.com/mozilla/spicedham/issues
:License:      Mozilla Public License Version 2.0; See LICENSE
:Contributors: See AUTHORS.rst


Install
=======

From PyPI (doesn't work, yet)
-----------------------------

Run::

    $ pip install spicedham

Configuration
-------------
See ``docs/intsallation.rst``.


For hacking
-----------

Run::

    # Get the code
    $ git clone https://github.com/mozilla/spicedham

    # Create a virtualenvironment
    $ pip install -e .

API
---
The API for spicedham is simple. There are three steps you need to do to
classify spam:
1. Load the plugins:

:: 
	from spicedham import load_plugins
	load_plugins()

2. Train on data. The arguments are:
	- Some tag so different kinds of data don't get mixed up
	- A list of words or other strings which can be scanned for spamminess
	- A boolean indicating whether a message is spam

::
	from spicedham import train
	train('user_message', ['I', 'love', 'firefox'], False)
	train('user_message', ['SPAM!'], True)

3. Classify some data. The first two arguments are the same as above:

::
	from spicedham import classify
	classify('user_message', ['maybe', 'I'm', 'spam', 'or', 'maybe', 'not'])
<commit_msg>Update the API docs in the README<commit_after>=========
spicedham
=========

Spam filter library developed for input
--------

:Code:         https://github.com/mozilla/spicedham/
:Issues:       https://github.com/mozilla/spicedham/issues
:License:      Mozilla Public License Version 2.0; See LICENSE
:Contributors: See AUTHORS.rst


Install
=======

From PyPI (doesn't work, yet)
-----------------------------

Run::

    $ pip install spicedham

Configuration
-------------
See ``docs/intsallation.rst``.


For hacking
-----------

Run::

    # Get the code
    $ git clone https://github.com/mozilla/spicedham

    # Create a virtualenvironment
    $ pip install -e .

API
---
The API for spicedham is simple. There are three steps you need to do to
classify spam:
1. Load the plugins:

:: 
	from spicedham import load_plugins
	load_plugins()

2. Train on data. The arguments are:
	- A list of words or other strings which can be scanned for spamminess
	- A boolean indicating whether a message is spam

::
	from spicedham import train
	train(['I', 'love', 'firefox'], False)
	train(['SPAM!'], True)

3. Classify some data.

::
	from spicedham import classify
	classify(['maybe', 'I'm', 'spam', 'or', 'maybe', 'not'])

{'fraction_non_alphanumeric': 0.1651803024428073, 'fraction_numerical': 0.0038774718883288098, 'mean_word_length': 2.9269406392694064, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1391829', 'n_tokens_mistral': 824, 'n_tokens_neox': 771, 'n_words': 289}