Giter Site home page Giter Site logo

Tests look strange about talon HOT 2 CLOSED

mailgun avatar mailgun commented on July 28, 2024
Tests look strange

from talon.

Comments (2)

justafucker avatar justafucker commented on July 28, 2024

What is also unclear to me is that in https://github.com/afedosenko/talon/blob/master/tests/signature/learning/featurespace_test.py

s = '''John Doe
VP Research and Development, Xxxx Xxxx Xxxxx
555-226-2345
[email protected]'''
    sender = 'John <[email protected]>'
    features = fs.features(sender)
    result = fs.apply_features(s, features)
    # note that we don't consider the first line because signatures don't
    # usually take all the text, empty lines are not considered
    eq_(result, [[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
                 [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                 [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
                 [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]])

the last line contains 'john' which mean the last '0' should be '1'

from talon.

obukhov-sergey avatar obukhov-sergey commented on July 28, 2024

Hi @justafucker. Sorry for confusion and thanks for your interest / questions. Will try to explain them.

The 1st test checks that ['Sergey', 'Obukhov'] will be among extracted names - not that they are the only ones extracted. E.g. if you modify the test and add serobnic to the list the test will pass as well.

There is a test that specifically checks that given [email protected] we'll extract sergey: https://github.com/mailgun/talon/blob/master/tests/signature/learning/helpers_test.py#L103

But we definitely encourage you to submit a PR if you find tests / code confusing and wish to contribute / improve them.

Regarding your 2nd question. The algo looks for lines like "John Doe" or "John" or "Doe" i.e. a line should end with extracted name or extracted name should be a detached word. This requirement might seem strange in respect to "[email protected]" but in general it helps to avoid false positives when extracted name happens to be some general sequence of chars that might occurs in a line.

from talon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.