#!/usr/bin/env python
#-*- coding: UTF-8 -*-
'''
Created on 31.05.2009
@author: snoa
'''
class Koryawki():
'''
Коряво уникализирует текст
- вставляет перед окончаниями прилагательных разделитель unik
- меняет некоторые символы на английские и цифры, схожие по начертанию
'''
unik = "'"
okonchaniya = ['ой','ый','ий','ый','ое','ее','ая','ые','ие',
'ого','его','ей','ых','ому','ему','им','ым','ую',
'юю','ою','ими','ыми','ом','ем','ию','ия']
other = {' в ':' B ',' при ':' пpu ',' и ':' u ',' о ':' 0 '}
def begin(self): self.debug(u"Корявки включены")
def end(self): pass
def run(self, title, text, date, tags):
for okonchanie in self.okonchaniya:
intext = "%s " % okonchanie
reptext = "%s%s " % (self.unik, okonchanie)
text = text.replace(intext, reptext)
for (in_other,out_other) in self.other.items():
text = text.replace(in_other, out_other)
return (title, text, date, tags)
def get_object():
return Koryawki()