How to use the mlxtend.text.generalize_names function in mlxtend

To help you get started, we’ve selected a few mlxtend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rasbt / mlxtend / tests / tests_text / test_generalize_names.py View on Github external
assert(generalize_names("Samuel Eto'o") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names('Xavi') == 'xavi')
    assert(generalize_names('Yaya Toure') == 'toure y')
    assert(generalize_names('Pozo, Jose Angel') ==  'pozo j')
    assert(generalize_names('Pozo, Jose Angel') == 'pozo j')
    assert(generalize_names('Jose Angel Pozo') == 'pozo j')
    assert(generalize_names('Jose Pozo') == 'pozo j')
    assert(generalize_names('Pozo, Jose Angel', firstname_output_letters=2) == 'pozo jo')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=2) == 'etoo sa')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=0) == 'etoo')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')

    assert(generalize_names("van Persie, Robin", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Robin van Persie", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Rafael van der Vaart", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("van der Vaart, Rafael", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("Ben Hamer") == 'hamer b')
github rasbt / mlxtend / tests / tests_text / test_generalize_names.py View on Github external
assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names('Xavi') == 'xavi')
    assert(generalize_names('Yaya Toure') == 'toure y')
    assert(generalize_names('Pozo, Jose Angel') ==  'pozo j')
    assert(generalize_names('Pozo, Jose Angel') == 'pozo j')
    assert(generalize_names('Jose Angel Pozo') == 'pozo j')
    assert(generalize_names('Jose Pozo') == 'pozo j')
    assert(generalize_names('Pozo, Jose Angel', firstname_output_letters=2) == 'pozo jo')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=2) == 'etoo sa')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=0) == 'etoo')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')

    assert(generalize_names("van Persie, Robin", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Robin van Persie", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Rafael van der Vaart", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("van der Vaart, Rafael", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("Ben Hamer") == 'hamer b')
github rasbt / mlxtend / tests / tests_text / test_generalize_names.py View on Github external
def test_generalize_names():

    assert(generalize_names("Samuel Eto'o") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names('Xavi') == 'xavi')
    assert(generalize_names('Yaya Toure') == 'toure y')
    assert(generalize_names('Pozo, Jose Angel') ==  'pozo j')
    assert(generalize_names('Pozo, Jose Angel') == 'pozo j')
    assert(generalize_names('Jose Angel Pozo') == 'pozo j')
    assert(generalize_names('Jose Pozo') == 'pozo j')
    assert(generalize_names('Pozo, Jose Angel', firstname_output_letters=2) == 'pozo jo')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=2) == 'etoo sa')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=0) == 'etoo')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')

    assert(generalize_names("van Persie, Robin", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Robin van Persie", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Rafael van der Vaart", output_sep=', ') == 'vandervaart, r')
github rasbt / mlxtend / tests / tests_text / test_generalize_names.py View on Github external
def test_generalize_names():

    assert(generalize_names("Samuel Eto'o") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names('Xavi') == 'xavi')
    assert(generalize_names('Yaya Toure') == 'toure y')
    assert(generalize_names('Pozo, Jose Angel') ==  'pozo j')
    assert(generalize_names('Pozo, Jose Angel') == 'pozo j')
    assert(generalize_names('Jose Angel Pozo') == 'pozo j')
    assert(generalize_names('Jose Pozo') == 'pozo j')
    assert(generalize_names('Pozo, Jose Angel', firstname_output_letters=2) == 'pozo jo')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=2) == 'etoo sa')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=0) == 'etoo')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')

    assert(generalize_names("van Persie, Robin", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Robin van Persie", output_sep=', ') == 'vanpersie, r')
github rasbt / mlxtend / tests / tests_text / test_generalize_names.py View on Github external
def test_generalize_names():

    assert(generalize_names("Samuel Eto'o") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names('Xavi') == 'xavi')
    assert(generalize_names('Yaya Toure') == 'toure y')
    assert(generalize_names('Pozo, Jose Angel') ==  'pozo j')
    assert(generalize_names('Pozo, Jose Angel') == 'pozo j')
    assert(generalize_names('Jose Angel Pozo') == 'pozo j')
    assert(generalize_names('Jose Pozo') == 'pozo j')
    assert(generalize_names('Pozo, Jose Angel', firstname_output_letters=2) == 'pozo jo')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=2) == 'etoo sa')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=0) == 'etoo')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')

    assert(generalize_names("van Persie, Robin", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Robin van Persie", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Rafael van der Vaart", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("van der Vaart, Rafael", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("Ben Hamer") == 'hamer b')
github rasbt / mlxtend / tests / tests_text / test_generalize_names.py View on Github external
def test_generalize_names():

    assert(generalize_names("Samuel Eto'o") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names('Xavi') == 'xavi')
    assert(generalize_names('Yaya Toure') == 'toure y')
    assert(generalize_names('Pozo, Jose Angel') ==  'pozo j')
    assert(generalize_names('Pozo, Jose Angel') == 'pozo j')
    assert(generalize_names('Jose Angel Pozo') == 'pozo j')
    assert(generalize_names('Jose Pozo') == 'pozo j')
    assert(generalize_names('Pozo, Jose Angel', firstname_output_letters=2) == 'pozo jo')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=2) == 'etoo sa')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=0) == 'etoo')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')

    assert(generalize_names("van Persie, Robin", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Robin van Persie", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Rafael van der Vaart", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("van der Vaart, Rafael", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("Ben Hamer") == 'hamer b')
github rasbt / mlxtend / tests / tests_text / test_generalize_names.py View on Github external
def test_generalize_names():

    assert(generalize_names("Samuel Eto'o") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names('Xavi') == 'xavi')
    assert(generalize_names('Yaya Toure') == 'toure y')
    assert(generalize_names('Pozo, Jose Angel') ==  'pozo j')
    assert(generalize_names('Pozo, Jose Angel') == 'pozo j')
    assert(generalize_names('Jose Angel Pozo') == 'pozo j')
    assert(generalize_names('Jose Pozo') == 'pozo j')
    assert(generalize_names('Pozo, Jose Angel', firstname_output_letters=2) == 'pozo jo')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=2) == 'etoo sa')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=0) == 'etoo')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')

    assert(generalize_names("van Persie, Robin", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Robin van Persie", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Rafael van der Vaart", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("van der Vaart, Rafael", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("Ben Hamer") == 'hamer b')
github rasbt / mlxtend / tests / tests_text / test_generalize_names.py View on Github external
assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names('Xavi') == 'xavi')
    assert(generalize_names('Yaya Toure') == 'toure y')
    assert(generalize_names('Pozo, Jose Angel') ==  'pozo j')
    assert(generalize_names('Pozo, Jose Angel') == 'pozo j')
    assert(generalize_names('Jose Angel Pozo') == 'pozo j')
    assert(generalize_names('Jose Pozo') == 'pozo j')
    assert(generalize_names('Pozo, Jose Angel', firstname_output_letters=2) == 'pozo jo')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=2) == 'etoo sa')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=0) == 'etoo')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')

    assert(generalize_names("van Persie, Robin", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Robin van Persie", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Rafael van der Vaart", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("van der Vaart, Rafael", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("Ben Hamer") == 'hamer b')
github rasbt / mlxtend / tests / tests_text / test_generalize_names.py View on Github external
def test_generalize_names():

    assert(generalize_names("Samuel Eto'o") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names('Xavi') == 'xavi')
    assert(generalize_names('Yaya Toure') == 'toure y')
    assert(generalize_names('Pozo, Jose Angel') ==  'pozo j')
    assert(generalize_names('Pozo, Jose Angel') == 'pozo j')
    assert(generalize_names('Jose Angel Pozo') == 'pozo j')
    assert(generalize_names('Jose Pozo') == 'pozo j')
    assert(generalize_names('Pozo, Jose Angel', firstname_output_letters=2) == 'pozo jo')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=2) == 'etoo sa')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=0) == 'etoo')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')

    assert(generalize_names("van Persie, Robin", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Robin van Persie", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Rafael van der Vaart", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("van der Vaart, Rafael", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("Ben Hamer") == 'hamer b')
github rasbt / mlxtend / tests / tests_text / test_generalize_names.py View on Github external
def test_generalize_names():

    assert(generalize_names("Samuel Eto'o") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names("Eto'o, Samuel") == 'etoo s')
    assert(generalize_names('Xavi') == 'xavi')
    assert(generalize_names('Yaya Toure') == 'toure y')
    assert(generalize_names('Pozo, Jose Angel') ==  'pozo j')
    assert(generalize_names('Pozo, Jose Angel') == 'pozo j')
    assert(generalize_names('Jose Angel Pozo') == 'pozo j')
    assert(generalize_names('Jose Pozo') == 'pozo j')
    assert(generalize_names('Pozo, Jose Angel', firstname_output_letters=2) == 'pozo jo')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=2) == 'etoo sa')
    assert(generalize_names("Eto'o, Samuel", firstname_output_letters=0) == 'etoo')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')
    assert(generalize_names("Eto'o, Samuel", output_sep=', ') == 'etoo, s')

    assert(generalize_names("van Persie, Robin", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Robin van Persie", output_sep=', ') == 'vanpersie, r')
    assert(generalize_names("Rafael van der Vaart", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("van der Vaart, Rafael", output_sep=', ') == 'vandervaart, r')
    assert(generalize_names("Ben Hamer") == 'hamer b')