SHARE
TWEET

Dwujeścica system Polish cyrillizator

Hellerick_Ferlibay Jan 29th, 2016 (edited) 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Polish Cyrillic script, converter algorithm  
  2. # Polska Cyrilica, algorytm przemiany
  3. # Польская кириллица, алгоритм замены
  4.  
  5. def translit(w):
  6.     global watch
  7.     if System==Dwujescica:
  8.  
  9.         w = re.sub(r'\b(ad|bez|kon|nad|ob|od|pod|pół|ponad|poz|przed|przeciw|roz|sub|w|współ|wszech|wz|z|zd)j',r'\1ъj',w)
  10.  
  11.         w = re.sub(r'di([aąeęioóu])',r'dïj\1',w)
  12.         w = re.sub(r'li([aąeęioóu])',r'łьj\1',w)
  13.         w = re.sub(r'ri([aąeęioóu])',r'rïj\1',w)
  14.         w = re.sub(r'ti([aąeęioóu])',r'tïj\1',w)
  15.  
  16.         w = re.sub(r'dzi([aąeęoóu])',r'dь\1',w)
  17.         w = re.sub(r'ci([aąeęoóu])',r'tь\1',w)
  18.         #w = re.sub(r'l([aąeęoóu])',r'łь\1',w)
  19.  
  20.         w = re.sub(r'di',r'dï',w)
  21.         w = re.sub(r'ri',r'rï',w)
  22.         w = re.sub(r'ti',r'tï',w)
  23.  
  24.         w = re.sub(r'cj',r'cïj',w)
  25.         w = re.sub(r'dj',r'dïj',w)
  26.         w = re.sub(r'nj',r'nïj',w)
  27.         w = re.sub(r'rj',r'rïj',w)
  28.         w = re.sub(r'sj',r'sïj',w)
  29.         w = re.sub(r'tj',r'tïj',w)
  30.         w = re.sub(r'zj',r'zïj',w)
  31.  
  32.         w = re.sub(r'([bdfghkłmnprstwz])i([aąeęoóu])',r'\1ь\2',w)
  33.  
  34.         w = re.sub(r'dź',r'dь',w)
  35.         w = re.sub(r'rz',r'rь',w)
  36.         w = re.sub(r'ć',r'tь',w)
  37.         w = re.sub(r'l',r'łь',w)
  38.         w = re.sub(r'ń',r'nь',w)
  39.         w = re.sub(r'ś',r'sь',w)
  40.         w = re.sub(r'ź',r'zь',w)
  41.  
  42.         w = re.sub(r'dzi',r'di',w)
  43.         w = re.sub(r'rьy',r'ri',w)
  44.         w = re.sub(r'ci',r'ti',w)
  45.         w = re.sub(r'łьi',r'łi',w)
  46.         w = re.sub(r'ьji',r'ьi',w)
  47.         w = re.sub(r'ï?ji',r'ïi',w)
  48.  
  49.         w = re.sub(r'([dtsz])ь([bdfghkłmnprstwz][iь])',r'\1\2',w)
  50.         w = re.sub(r'łьł([iь])',r'łł\1',w)
  51.  
  52.         w = re.sub(r'([bcdfghjkłmnprstwzż])j',r'\1ьj',w)
  53.  
  54.         w = re.sub(r'[ьj]a',r'я',w)
  55.         w = re.sub(r'[ьj]ą',r'ѭ',w)
  56.         w = re.sub(r'[ьj]e',r'є',w)
  57.         w = re.sub(r'[ьj]ę',r'ѩ',w)
  58.         w = re.sub(r'[ьj]o',r'є̈',w)
  59.         w = re.sub(r'[ьj]ó',r'є́',w)
  60.         w = re.sub(r'[ьj]u',r'ю',w)
  61.  
  62.         w = re.sub(r'ch',r'х',w)
  63.         w = re.sub(r'cz',r'ч',w)
  64.         w = re.sub(r'sz',r'ш',w)
  65.         w = re.sub(r'ó',r'о́',w)
  66.  
  67.         for c in zip('aąbcdeęfghiïjkłmnopqrstuvwxyzż',
  68.                      'аѫбцдеѧфгхиійклмнопкрстуввхызж'):
  69.             w = re.sub(c[0], c[1], w)
  70.  
  71.     return w
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top