class TestSocialLM(unittest.TestCase): def setUp(self): self.lm = SocialLM() def test_tokenize_c(self): tokz = SocialLM.tokenize('hello', mode='c') self.assertEqual(tokz,['h','e','l','l','o']) def test_tokenize_w(self): tokz = SocialLM.tokenize('hello world', mode='w') self.assertEqual(tokz,['hello','world']) def test_is_mention_at(self): ism = SocialLM.is_mention_line('@gr33ndata') self.assertEqual(ism,True) def test_is_mention_http(self): ism = SocialLM.is_mention_line('http://www.yahoo.com') self.assertEqual(ism,True) def test_is_mention_https(self): ism = SocialLM.is_mention_line('https://www.yahoo.com') self.assertEqual(ism,True) def test_is_not_mention(self): ism = SocialLM.is_mention_line('This is https://www.yahoo.com') self.assertEqual(ism,False) def test_normalize_mention_lower(self): norm_txt = self.lm.normalize(u'Dear @user How Are You?') self.assertEqual(norm_txt, u'dear how are you?')
def test_is_not_mention(self): ism = SocialLM.is_mention_line('This is https://www.yahoo.com') self.assertEqual(ism,False)
def test_is_mention_https(self): ism = SocialLM.is_mention_line('https://www.yahoo.com') self.assertEqual(ism,True)
def test_is_mention_at(self): ism = SocialLM.is_mention_line('@gr33ndata') self.assertEqual(ism,True)
def test_tokenize_w(self): tokz = SocialLM.tokenize('hello world', mode='w') self.assertEqual(tokz,['hello','world'])
def test_tokenize_c(self): tokz = SocialLM.tokenize('hello', mode='c') self.assertEqual(tokz,['h','e','l','l','o'])
def setUp(self): self.lm = SocialLM()