コード例 #1
0
 def test_mix_of_words(self):
     s = "Jag han hon och den det dem hen och så vidare"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(han=1, hon=1, den=1, hen=1), r)
コード例 #2
0
 def test_subword_suffix_before_word(self):
     s = "döden den"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(den=1), r)
コード例 #3
0
 def test_subword_prefix_before_word(self):
     s = "hans han"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(han=1), r)
コード例 #4
0
 def test_denna_only_multiple(self):
     s = "denna denna, denna! denna. denna? Denna"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(denna=6), r)
コード例 #5
0
 def test_escaped_character(self):
     s = "\"BYT HATAR DEN\""
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(den=1), r)
コード例 #6
0
 def test_hon_punctuation(self):
     s = "Inga pronomer, förutom hon, här inte"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(hon=1), r)
コード例 #7
0
 def test_den_multiple(self):
     s = "den pronomen finns här den"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(den=2), r)
コード例 #8
0
 def test_hen_only(self):
     s = "hen"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(hen=1), r)
コード例 #9
0
 def test_han_capital_letter(self):
     s = "Han är en pronom"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(han=1), r)
コード例 #10
0
 def test_denne(self):
     s = "Inga pronomer här inte, denne räknas"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(denne=1), r)
コード例 #11
0
 def test_hon_middle(self):
     s = "Inga pronomer förutom hon här inte"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(hon=1), r)
コード例 #12
0
 def test_han_end(self):
     s = "Inga pronomer här inte, förutom han"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(han=1), r)
コード例 #13
0
 def test_no_pronouns(self):
     s = "Inga pronomer här inte"
     r = count_multiple_words(s, PRONOUNS)
     self.assertEqual(expectedResult(), r)
コード例 #14
0
 def test_empty_word_list(self):
     s = "Random string here"
     r = count_multiple_words(s, [])
     self.assertEqual({}, r)