예제 #1
0
 def test_analyze_knp(self):
     self.assertEqual(len(self.knp_info), 1)
     self.assertEqual(len(self.knp_info[0]["phrases"]), 14)
     self.assertEqual(len(self.knp_info[0]["basics"]), 20)
     self.assertEqual(len(self.knp_info[0]["morphemes"]), 41)
     self.assertEqual(self.knp_info[0]["phrases"][0]["basics"], [0, 1, 2])
     self.assertEqual(self.knp_info[0]["phrases"][0]["morphemes"], [0, 1, 2, 3, 4])
     self.assertEqual(self.knp_info[0]["phrases"][0]["relation"], 6)
     self.assertEqual(self.knp_info[0]["phrases"][0]["relationType"], "D")
     self.assertEqual(self.knp_info[0]["phrases"][-1]["basics"], [19])
     self.assertEqual(self.knp_info[0]["phrases"][-1]["morphemes"], [38, 39, 40])
     self.assertEqual(self.knp_info[0]["phrases"][-1]["relation"], -1)
     self.assertEqual(self.knp_info[0]["phrases"][-1]["relationType"], "D")
     # k2j.show_analyzed_knp_info(self.knp_info[0])
     file = open('test2_knp.txt')
     self.knp_info = k2j.execute(file.read())
     self.assertEqual(len(self.knp_info), 6)
예제 #2
0
 def setUp(self):
     file = open('test1_knp.txt')
     self.knp_info = k2j.execute(file.read())
     file.close()