Grammalecte  Diff

Differences From Artifact [219d3111da]:

To Artifact [a8d17c5bd5]:


1
2
3
4
5
6
7
8
9


1
2
3
4
5
6
7
-
-







#!python3

"""
Text formatter
"""

import re


243
244
245
246
247
248
249

250
251
252
253
254
255
256

257
258
259
260
261
241
242
243
244
245
246
247
248
249
250
251
252
253
254

255
256
257
258
259
260







+






-
+





    ("ma_word", True),
    ("ma_1letter_lowercase", False),
    ("ma_1letter_uppercase", False),
]


class TextFormatter:
    "Text Formatter: purge typographic mistakes from text"

    def __init__ (self):
        for sOpt, lTup in dReplTable.items():
            for i, t in enumerate(lTup):
                lTup[i] = (re.compile(t[0]), t[1])

    def formatText (self, sText, **args):
    def formatText (self, sText):
        for sOptName, bVal in lOptRepl:
            if bVal:
                for zRgx, sRep in dReplTable[sOptName]:
                    sText = zRgx.sub(sRep, sText)
        return sText