コード例 #1
0
 def _test_chunking_11(self):
     # This case is different from the previous one because here
     # the required list length of 3 cannot be met because the input
     # does not match rather than the input running out. In this case,
     # there is only one possible chunk list.
     #self.assertTrue(False)
     self.assertEqual([[u'阿', u'一', u'阿']],
                      zl.get_chunks(u'阿一阿XXX', zl.TRADITIONAL, 0,
                                    self._dict, 2, 3))
コード例 #2
0
 def _test_chunking_9(self):
     self.assertEqual([[u'阿', u'比'], [u'阿比']],
                      zl.get_chunks(u'阿比', zl.TRADITIONAL, 0, self._dict, 2,
                                    3))
コード例 #3
0
 def _test_chunking_7(self):
     # List length of 3. Should be ignored because not enough input.
     self.assertEqual([[u'阿', u'西西', u'比']],
                      zl.get_chunks(u'阿西西比', zl.TRADITIONAL, 0, self._dict,
                                    2, 3))
コード例 #4
0
 def _test_chunking_2(self):
     self.assertEqual([[u'阿', u'阿']],
                      zl.get_chunks(u'阿阿', zl.TRADITIONAL, 0, self._dict, 1,
                                    2))
コード例 #5
0
 def _test_chunking_1(self):
     # List length of 2. Should be ignored because there's not enough input.
     self.assertEqual([[u'阿']],
                      zl.get_chunks(u'阿', zl.TRADITIONAL, 0, self._dict, 1,
                                    2))
コード例 #6
0
 def _test_chunking_1(self):
     # One character input should yield a single list with one chunk.
     self.assertEqual([[u'阿']],
                      zl.get_chunks(u'阿', zl.TRADITIONAL, 0, self._dict, 1,
                                    1))
コード例 #7
0
 def _test_chunking_0(self):
     # List lengtf of 0 should yield a single empty chunk list.
     self.assertEqual([[]],
                      zl.get_chunks('', zl.TRADITIONAL, 0, self._dict, 1,
                                    0))
コード例 #8
0
 def test_chunking_16(self):
     self.assertEqual([[u'阿地']],
                      zl.get_chunks(u'阿地', zl.TRADITIONAL, 0, self._dict, 2,
                                    3))
コード例 #9
0
 def _test_chunking_14(self):
     self.assertEqual(
         [[u'一', u'阿', u'阿'], [u'一', u'阿', u'阿地'], [u'一阿', u'阿地']],
         zl.get_chunks(u'一阿阿地', zl.TRADITIONAL, 0, self._dict, 2, 3))
コード例 #10
0
 def _test_chunking_12(self):
     # Test when the start of the input has no matching words.
     self.assertEqual([],
                      zl.get_chunks('X', zl.TRADITIONAL, 0, self._dict, 1,
                                    1))
コード例 #11
0
 def _test_chunking_10(self):
     # Requires a list of length 3.  However, for the second chunk list
     # the input runs out, so it has to return a short list.
     self.assertEqual([[u'阿', u'一', u'阿'], [u'阿', u'一阿']],
                      zl.get_chunks(u'阿一阿', zl.TRADITIONAL, 0, self._dict,
                                    2, 3))