def prepare(self, text): text = normalize.shorten_repeat(text, 3) text = jctconv.h2z(text) text = re_a_tag.sub('', text) text = kigou.sub('', text) for (old, new) in self.paraphrases['before'].items(): text = text.replace(old, new) return text
def prepare(self, text): text = normalize.shorten_repeat(text, 3) text = jaconv.h2z(text) text = re_a_tag.sub('', text) text = kigou.sub('', text) for (old, new) in self.paraphrases['before'].items(): text = text.replace(old, new) return text
def test_shorten_repeat(): got = normalize.shorten_repeat('kieeee', 2) assert got == 'kiee' got = normalize.shorten_repeat(u'無駄無駄無駄', 1) assert got == u'無駄'
def test_shorten_repeat(): got = normalize.shorten_repeat('kieeee', 2) assert_equals(got, 'kiee') got = normalize.shorten_repeat(u'無駄無駄無駄', 1) assert_equals(got, u'無駄')