mailgun / talon

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

talon

Mailgun library to extract message quotations and signatures.

If you ever tried to parse message quotations or signatures you know that absence of any formatting standards in this area could make this task a nightmare. Hopefully this library will make your life much easier. The name of the project is inspired by TALON - multipurpose robot designed to perform missions ranging from reconnaissance to combat and operate in a number of hostile environments. That’s what a good quotations and signature parser should be like 😄

Usage

Here’s how you initialize the library and extract a reply from a text message:

To extract a reply from html:

Often the best way is the easiest one. Here’s how you can extract signature from email message without any machine learning fancy stuff:

Quick and works like a charm 90% of the time. For other 10% you can use the power of machine learning algorithms:

For machine learning talon currently uses the scikit-learn library to build SVM classifiers. The core of machine learning algorithm lays in talon.signature.learning package. It defines a set of features to apply to a message (featurespace.py), how data sets are built (dataset.py), classifier’s interface (classifier.py).

Currently the data used for training is taken from our personal email conversations and from ENRON dataset. As a result of applying our set of features to the dataset we provide files classifier and train.data that don’t have any personal information but could be used to load trained classifier. Those files should be regenerated every time the feature/data set is changed.

To regenerate the model files, you can run

or

Open-source Dataset

Recently we started a forge project to create an open-source, annotated dataset of raw emails. In the project we used a subset of ENRON data, cleansed of private, health and financial information by EDRM. At the moment over 190 emails are annotated. Any contribution and collaboration on the project are welcome. Once the dataset is ready we plan to start using it for talon.

Training on your dataset

talon comes with a pre-processed dataset and a pre-trained classifier. To retrain the classifier on your own dataset of raw emails, structure and annotate them in the same way the forge project does. Then do:

Note that for signature extraction you need just the folder with the positive samples with annotated signature lines (P folder).

Research

The library is inspired by the following research papers and projects:

About

License:Apache License 2.0


Languages

Language:Python 99.4%Language:Dockerfile 0.4%Language:Shell 0.2%