Esempio n. 1
0
def format_translation(t):
    t = ' '.join([x.strip() for x in META_RE.findall(t) if x.strip()])

    t = re.sub(r'{\.}', '{\\cxp. }', t)
    t = re.sub(r'{!}', '{\\cxp! }', t)
    t = re.sub(r'{\?}', '{\\cxp? }', t)
    t = re.sub(r'{\,}', '{\\cxp, }', t)
    t = re.sub(r'{:}', '{\\cxp: }', t)
    t = re.sub(r'{;}', '{\\cxp; }', t)
    t = re.sub(r'{\^}', '\\cxds ', t)
    t = re.sub(r'{\^([^^}]*)}', '\\cxds \\1', t)
    t = re.sub(r'{([^^}]*)\^}', '\\1\\cxds ', t)
    t = re.sub(r'{\^([^^}]*)\^}', '\\cxds \\1\\cxds ', t)
    t = re.sub(r'{-\|}', '\\cxfc ', t)
    t = re.sub(r'{>}', '\\cxfls ', t)
    t = re.sub(r'{ }', ' ', t)
    t = re.sub(r'{&([^}]+)}', '{\\cxfing \\1}', t)
    t = re.sub(r'{#([^}]+)}', '\\{#\\1\\}', t)
    t = re.sub(r'{PLOVER:([a-zA-Z]+)}', '\\{PLOVER:\\1\\}', t)
    t = re.sub(r'\\"', '"', t)

    return t
Esempio n. 2
0
def format_translation(t):
    t = ' '.join([x.strip() for x in META_RE.findall(t) if x.strip()])
    
    t = re.sub(r'{\.}', '{\\cxp. }', t)
    t = re.sub(r'{!}', '{\\cxp! }', t)
    t = re.sub(r'{\?}', '{\\cxp? }', t)
    t = re.sub(r'{\,}', '{\\cxp, }', t)
    t = re.sub(r'{:}', '{\\cxp: }', t)
    t = re.sub(r'{;}', '{\\cxp; }', t)
    t = re.sub(r'{\^}', '\\cxds ', t)
    t = re.sub(r'{\^([^^}]*)}', '\\cxds \\1', t)
    t = re.sub(r'{([^^}]*)\^}', '\\1\\cxds ', t)
    t = re.sub(r'{\^([^^}]*)\^}', '\\cxds \\1\\cxds ', t)
    t = re.sub(r'{-\|}', '\\cxfc ', t)
    t = re.sub(r'{>}', '\\cxfls ', t)
    t = re.sub(r'{ }', ' ', t)
    t = re.sub(r'{&([^}]+)}', '{\\cxfing \\1}', t)
    t = re.sub(r'{#([^}]+)}', '\\{#\\1\\}', t)
    t = re.sub(r'{PLOVER:([a-zA-Z]+)}', '\\{PLOVER:\\1\\}', t)
    t = re.sub(r'\\"', '"', t)
    
    return t
Esempio n. 3
0
def format_translation(t):
    t = " ".join([x.strip() for x in META_RE.findall(t) if x.strip()])

    t = re.sub(r"{\.}", "{\\cxp. }", t)
    t = re.sub(r"{!}", "{\\cxp! }", t)
    t = re.sub(r"{\?}", "{\\cxp? }", t)
    t = re.sub(r"{\,}", "{\\cxp, }", t)
    t = re.sub(r"{:}", "{\\cxp: }", t)
    t = re.sub(r"{;}", "{\\cxp; }", t)
    t = re.sub(r"{\^}", "\\cxds ", t)
    t = re.sub(r"{\^([^^}]*)}", "\\cxds \\1", t)
    t = re.sub(r"{([^^}]*)\^}", "\\1\\cxds ", t)
    t = re.sub(r"{\^([^^}]*)\^}", "\\cxds \\1\\cxds ", t)
    t = re.sub(r"{-\|}", "\\cxfc ", t)
    t = re.sub(r"{>}", "\\cxfls ", t)
    t = re.sub(r"{ }", " ", t)
    t = re.sub(r"{&([^}]+)}", "{\\cxfing \\1}", t)
    t = re.sub(r"{#([^}]+)}", "\\{#\\1\\}", t)
    t = re.sub(r"{PLOVER:([a-zA-Z]+)}", "\\{PLOVER:\\1\\}", t)
    t = re.sub(r'\\"', '"', t)

    return t