# Path: talon/signature/learning/dataset.py
# SENDER_SUFFIX = '_sender'
# BODY_SUFFIX = '_body'
# SIGNATURE_ANNOTATION = '#sig#'
# REPLY_ANNOTATION = '#reply#'
# ANNOTATIONS = [SIGNATURE_ANNOTATION, REPLY_ANNOTATION]
#             X = build_pattern(msg, features(sender))
#                 X = build_pattern(line, features(sender))
# def is_sender_filename(filename):
# def build_sender_filename(msg_filename):
# def parse_msg_sender(filename, sender_known=True):
# def build_detection_class(folder, dataset_filename,
#                           label, sender_known=True):
# def build_detection_dataset(folder, dataset_filename,
#                             sender_known=True):
# def build_extraction_dataset(folder, dataset_filename,
#                              sender_known=True):
# 
# Path: talon/signature/learning/featurespace.py
# def features(sender=''):
#     '''Returns a list of signature features.'''
#     return [
#         # This one isn't from paper.
#         # Meant to match companies names, sender's names, address.
#         many_capitalized_words,
#         # This one is not from paper.
#         # Line is too long.
#         # This one is less aggressive than `Line is too short`
#         lambda line: 1 if len(line) > TOO_LONG_SIGNATURE_LINE else 0,
#         # Line contains email pattern.
#         binary_regex_search(RE_EMAIL),
#         # Line contains url.
#         binary_regex_search(RE_URL),
#         # Line contains phone number pattern.
#         binary_regex_search(RE_RELAX_PHONE),
#         # Line matches the regular expression "^[\s]*---*[\s]*$".
#         binary_regex_match(RE_SEPARATOR),
#         # Line has a sequence of 10 or more special characters.
#         binary_regex_search(RE_SPECIAL_CHARS),
#         # Line contains any typical signature words.
#         binary_regex_search(RE_SIGNATURE_WORDS),
#         # Line contains a pattern like Vitor R. Carvalho or William W. Cohen.
#         binary_regex_search(RE_NAME),
#         # Percentage of punctuation symbols in the line is larger than 50%
#         lambda line: 1 if punctuation_percent(line) > 50 else 0,
#         # Percentage of punctuation symbols in the line is larger than 90%
#         lambda line: 1 if punctuation_percent(line) > 90 else 0,
#         contains_sender_names(sender)
#         ]


from ... import *
from numpy import genfromtxt
from talon.signature.learning import dataset as d
from talon.signature.learning.featurespace import features
import os
# -*- coding: utf-8 -*-

from __future__ import absolute_import





def test_is_sender_filename():
    assert_false(d.is_sender_filename("foo/bar"))
    assert_false(d.is_sender_filename("foo/bar_body"))
    ok_(d.is_sender_filename("foo/bar_sender"))


def test_build_sender_filename():

# Path: talon/signature/learning/dataset.py
# SENDER_SUFFIX = '_sender'
# BODY_SUFFIX = '_body'
# SIGNATURE_ANNOTATION = '#sig#'
# REPLY_ANNOTATION = '#reply#'
# ANNOTATIONS = [SIGNATURE_ANNOTATION, REPLY_ANNOTATION]
#             X = build_pattern(msg, features(sender))
#                 X = build_pattern(line, features(sender))
# def is_sender_filename(filename):
# def build_sender_filename(msg_filename):
# def parse_msg_sender(filename, sender_known=True):
# def build_detection_class(folder, dataset_filename,
#                           label, sender_known=True):
# def build_detection_dataset(folder, dataset_filename,
#                             sender_known=True):
# def build_extraction_dataset(folder, dataset_filename,
#                              sender_known=True):
# 
# Path: talon/signature/learning/featurespace.py
# def features(sender=''):
#     '''Returns a list of signature features.'''
#     return [
#         # This one isn't from paper.
#         # Meant to match companies names, sender's names, address.
#         many_capitalized_words,
#         # This one is not from paper.
#         # Line is too long.
#         # This one is less aggressive than `Line is too short`
#         lambda line: 1 if len(line) > TOO_LONG_SIGNATURE_LINE else 0,
#         # Line contains email pattern.
#         binary_regex_search(RE_EMAIL),
#         # Line contains url.
#         binary_regex_search(RE_URL),
#         # Line contains phone number pattern.
#         binary_regex_search(RE_RELAX_PHONE),
#         # Line matches the regular expression "^[\s]*---*[\s]*$".
#         binary_regex_match(RE_SEPARATOR),
#         # Line has a sequence of 10 or more special characters.
#         binary_regex_search(RE_SPECIAL_CHARS),
#         # Line contains any typical signature words.
#         binary_regex_search(RE_SIGNATURE_WORDS),
#         # Line contains a pattern like Vitor R. Carvalho or William W. Cohen.
#         binary_regex_search(RE_NAME),
#         # Percentage of punctuation symbols in the line is larger than 50%
#         lambda line: 1 if punctuation_percent(line) > 50 else 0,
#         # Percentage of punctuation symbols in the line is larger than 90%
#         lambda line: 1 if punctuation_percent(line) > 90 else 0,
#         contains_sender_names(sender)
#         ]


# Path: tests/signature/learning/dataset_test.py
from ... import *
from numpy import genfromtxt
from talon.signature.learning import dataset as d
from talon.signature.learning.featurespace import features
import os

# -*- coding: utf-8 -*-

from __future__ import absolute_import





def test_is_sender_filename():
    assert_false(d.is_sender_filename("foo/bar"))
    assert_false(d.is_sender_filename("foo/bar_body"))
    ok_(d.is_sender_filename("foo/bar_sender"))


def test_build_sender_filename():

    eq_("foo/bar_sender", d.build_sender_filename("foo/bar_body"))