def test_feature_dict_n_and_i(self): sent = 'El Gato come pescado .'.split() fdict1 = { 'w': '.', 'wu': False, 'wt': False, 'wd': False, 'pw': 'pescado', 'nw': '</s>', 'pwu': False, 'nwu': False, 'pwt': False, 'nwt': False, 'pwd': False, 'nwd': False } fdict2 = {'w': '</s>', 'wu': False, 'wt': False, 'wd': False} self.assertEqual(feature_dict(sent, 4, 200), fdict1) self.assertEqual(feature_dict([], 0, 0), fdict2)
def test_feature_dict(self): sent = 'El gato come pescado .'.split() fdict = { 'w': 'el', # lower 'wu': False, # isupper 'wt': True, # istitle 'wd': False, # isdigit 'pw': '<s>', 'nw': 'gato', 'nwu': False, 'nwt': False, 'nwd': False, } self.assertEqual(feature_dict(sent, 0), fdict)
def test_feature_dict3(self): sent = 'El Gato come pescado .'.split() fdict = { 'w': '.', # lower 'wu': False, # isupper 'wt': False, # istitle 'wd': False, # isdigit 'pw': 'pescado', 'nw': '</s>', 'nwu': False, 'nwt': False, 'nwd': False, 'pwu': False, 'pwt': False, 'pwd': False, } self.assertEqual(feature_dict(sent, 4), fdict)
def test_feature_dict(self): sent = 'El gato come pescado .'.split() fdict = { 'lower': 'el', # lower 'isupper': False, # isupper 'istitle': True, # istitle 'isnumber': False, # isdigit 'p_lower': '<s>', 'p_istitle': False, 'p_isupper':False, 'p_isnumber':False, 'n_lower': 'gato', 'n_istitle': False, 'n_isupper':False, 'n_isnumber':False, } self.assertEqual(feature_dict(sent, 0), fdict)
def test_feature_dict(self): sent = 'El gato come pescado .'.split() fdict = { 'word_lowercase': 'el', # lower 'is_uppercase': False, # isupper 'is_capitalized': True, # istitle 'is_digit': False, # isdigit 'previous_word_lowercase': '<s>', 'previous_word_is_uppercase': False, 'previous_word_is_capitalized': False, 'previous_word_is_digit': False, 'next_word_lowercase': 'gato', 'next_word_is_uppercase': False, 'next_word_is_capitalized': False, 'next_word_is_digit': False, } self.assertEqual(feature_dict(sent, 0), fdict)
def test_feature_dict(self): sent = 'El gato come pescado .'.split() self.maxDiff = None fdict = { 'lower': 'el', 'istitle': True, 'isupper': False, 'isnumeric': False, 'alower': '', 'aistitle': False, 'aisupper': False, 'aisnumeric': False, 'plower': 'gato', 'pistitle': False, 'pisupper': False, 'pisnumeric': False, } self.assertEqual(feature_dict(sent, 0), fdict)