Grammalecte  Check-in [ffb80ebf4d]

Overview
Comment:[graphspell] use echo() instead of print(), because printing on Windows still sucks
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: ffb80ebf4dfb1760d856d3260fa34e5be96b906510d9c96c7a865c37be6af672
User & Date: olr on 2025-09-13 12:37:47
Other Links: manifest | tags
Context
2025-09-13
13:25
[graphspell] ad hoc suggestions with full uppercase words Leaf check-in: 7e24b83b14 user: olr tags: trunk, graphspell
12:37
[graphspell] use echo() instead of print(), because printing on Windows still sucks check-in: ffb80ebf4d user: olr tags: trunk, graphspell
2025-09-12
13:27
[fr] update dictionnaries again (due to wrong previous commit) check-in: c3a309fb13 user: olr tags: trunk, fr
Changes

Modified graphspell/str_transform.py from [928aa819c5] to [853d07d14c].

1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18










+







"""
Operations on strings:
- calculate distance between two strings
- transform strings with transformation codes
"""

import unicodedata
import re

from .char_player import distanceBetweenChars, dDistanceBetweenChars
from .echo import echo


#### N-GRAMS

def getNgrams (sWord, n=2):
    "return a list of Ngrams strings"
    return [ sWord[i:i+n]  for i in range(len(sWord)-n+1) ]
255
256
257
258
259
260
261
262

263
264
265
266
267
268
269
256
257
258
259
260
261
262

263
264
265
266
267
268
269
270







-
+









def showDistance (s1, s2):
    "display Damerau-Levenshtein distance and Sift4 distance between <s1> and <s2>"
    nDL = distanceDamerauLevenshtein(s1, s2)
    nS4 = distanceSift4(s1, s2)
    fJW = distanceJaroWinkler(s1, s2)
    print(s1, "", s2, "\tDL:", nDL, "\tS4:", nS4, "\tJW:", fJW)
    echo(f"{s1:22}  {s2:22} \tDL: {nDL}\tS4: {nS4}\tJW: {fJW}")



#### STEMMING OPERATIONS

## No stemming