Grammalecte  Check-in [73a7676ff0]

Overview
Comment:[graphspell] char_player: useless import
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: 73a7676ff02eb6985de5aed422789bde7c379cbd30cf8e5f89d759cb1dd2ddd2
User & Date: olr on 2020-09-10 19:36:45
Other Links: manifest | tags
Context
2020-09-10
22:05
[fr] ajustements check-in: a9c5f8dab7 user: olr tags: trunk, fr
19:36
[graphspell] char_player: useless import check-in: 73a7676ff0 user: olr tags: trunk, graphspell
19:34
[fr] tests: useless imports check-in: 2a513248b5 user: olr tags: trunk, fr
Changes

Modified graphspell/char_player.py from [75ad6388f2] to [e2b351100d].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
"""
List of similar chars
useful for suggestion mechanism
"""

import re


dDistanceBetweenChars = {
    "a": {},
    "e": {"é": 0.5},
    "é": {"e": 0.5},
    "i": {"y": 0.2},
    "o": {},





<
<







1
2
3
4
5


6
7
8
9
10
11
12
"""
List of similar chars
useful for suggestion mechanism
"""




dDistanceBetweenChars = {
    "a": {},
    "e": {"é": 0.5},
    "é": {"e": 0.5},
    "i": {"y": 0.2},
    "o": {},
34
35
36
37
38
39
40

41
42
43
44
45
46
47
    "w": {"v": 0.1},
    "x": {"c": 0.5, "k": 0.5, "q": 0.5, "s": 0.5},
    "z": {"s": 0.5}
}


def distanceBetweenChars (c1, c2):

    if c1 == c2:
        return 0
    if c1 not in dDistanceBetweenChars:
        return 1
    return dDistanceBetweenChars[c1].get(c2, 1)









>







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
    "w": {"v": 0.1},
    "x": {"c": 0.5, "k": 0.5, "q": 0.5, "s": 0.5},
    "z": {"s": 0.5}
}


def distanceBetweenChars (c1, c2):
    "returns a float between 0 and 1"
    if c1 == c2:
        return 0
    if c1 not in dDistanceBetweenChars:
        return 1
    return dDistanceBetweenChars[c1].get(c2, 1)