(text, counts)
| 101 | |
| 102 | |
| 103 | def _convert_text(text, counts): |
| 104 | def repl(mobj): |
| 105 | w = mobj.group(0) |
| 106 | american = MAPPING.get(w.lower()) |
| 107 | if not american: |
| 108 | return w |
| 109 | out = _apply_case(w, american) |
| 110 | if out != w: |
| 111 | counts[w.lower() + " -> " + american] += 1 |
| 112 | return out |
| 113 | return _WORD_RE.sub(repl, text) |
| 114 | |
| 115 | |
| 116 | def _convert_line(line, counts): |