skip to navigation
skip to content

talon 1.0.2

Mailgun library to extract message quotations and signatures.

Latest Version: 1.4.4

Mailgun library to extract message quotations and signatures.

If you ever tried to parse message quotations or signatures you know that absense 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 :smile:


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

import talon
from talon import quotations


text =  """Reply

-----Original Message-----


reply = quotations.extract_from(text, 'text/plain')
reply = quotations.extract_from_plain(text)
# reply == "Reply"

To extract a reply from html:

html = """Reply

    On 11-Apr-2011, at 6:54 PM, Bob &lt;; wrote:



reply = quotations.extract_from(html, 'text/html')
reply = quotations.extract_from_html(html)
# reply == "<html><body><p>Reply</p></body></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:

from talon.signature.bruteforce import extract_signature

message = """Wow. Awesome!
Bob Smith"""

text, signature = extract_signature(message)
# text == "Wow. Awesome!"
# signature == "--\nBob Smith"

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

from talon import signature

message = """Thanks Sasha, I can't go any higher and is why I limited it to the

John Doe
via mobile"""

text, signature = signature.extract(message, sender='')
# text == "Thanks Sasha, I can't go any higher and is why I limited it to the\nhomepage."
# signature == "John Doe\nvia mobile"

For machine learning talon currently uses PyML 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 (, how data sets are built (, classifier’s interface (

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 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.

File Type Py Version Uploaded on Size
talon-1.0.2.tar.gz (md5) Source 2014-07-24 52KB