Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
def test_shorten_repeat():
    got = normalize.shorten_repeat('kieeee', 2)
    assert got == 'kiee'
    got = normalize.shorten_repeat(u'無駄無駄無駄', 1)
    assert got == u'無駄'
Exemplo n.º 4
0
def test_shorten_repeat():
    got = normalize.shorten_repeat('kieeee', 2)
    assert got == 'kiee'
    got = normalize.shorten_repeat(u'無駄無駄無駄', 1)
    assert got == u'無駄'
Exemplo n.º 5
0
def test_shorten_repeat():
    got = normalize.shorten_repeat('kieeee', 2)
    assert_equals(got, 'kiee')
    got = normalize.shorten_repeat(u'無駄無駄無駄', 1)
    assert_equals(got, u'無駄')