Example #1
0
 def test_pinyin_parsing(self):
     base_pattern = zhuyin_table.pinyin_regex_pattern(
         StringIO(self.data)
     )
     pattern = re.compile(r'^(%s)+$' % base_pattern, re.UNICODE)
     assert not pattern.match(u'gdaymatehowsitgoing')
     assert pattern.match(u'beijingdaxue')
Example #2
0
    def __init__(self):
        self.replacement = '#'

        base_pattern = '(%s|%s)' % (
            zhuyin_table.pinyin_regex_pattern(),
            self.replacement,
        )
        self.single_pattern = re.compile(base_pattern, re.UNICODE)
        self.string_pattern = re.compile('(%s)+' % base_pattern, re.UNICODE)
        return