Overview
| Comment: | [graphspell] don’t use distanceBetweenChars for now |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | graphspell |
| Files: | files | file ages | folders |
| SHA3-256: |
624760bc198eb0a931eabb1d2357c5c8 |
| User & Date: | olr on 2025-09-16 10:11:13 |
| Other Links: | manifest | tags |
Context
|
2025-09-16
| ||
| 11:51 | [fr] faux positifs check-in: ac21b7279c user: olr tags: trunk, fr | |
| 10:11 | [graphspell] don’t use distanceBetweenChars for now check-in: 624760bc19 user: olr tags: trunk, graphspell | |
|
2025-09-15
| ||
| 13:38 | [fx][lo] add logo for Ville de Grenoble check-in: 7290cf2770 user: olr tags: trunk, fx, lo | |
Changes
Modified graphspell-js/str_transform.js from [47f22c7f5d] to [8e968e40a5].
| ︙ | ︙ | |||
138 139 140 141 142 143 144 |
matrix[i][0] = i;
}
for (let j = 0; j <= nLen2+1; j++) {
matrix[0][j] = j;
}
for (let i = 1; i <= nLen1; i++) {
for (let j = 1; j <= nLen2; j++) {
| | | | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
matrix[i][0] = i;
}
for (let j = 0; j <= nLen2+1; j++) {
matrix[0][j] = j;
}
for (let i = 1; i <= nLen1; i++) {
for (let j = 1; j <= nLen2; j++) {
let nCost = (s1[i-1] === s2[j-1]) ? 0 : 1;
//let nCost = char_player.distanceBetweenChars(s1[i-1], s2[j-1]);
matrix[i][j] = Math.min(
matrix[i-1][j] + 1, // Deletion
matrix[i][j-1] + 1, // Insertion
matrix[i-1][j-1] + nCost // Substitution
);
if (i > 1 && j > 1 && s1[i] == s2[j-1] && s1[i-1] == s2[j]) {
matrix[i][j] = Math.min(matrix[i][j], matrix[i-2][j-2] + nCost); // Transposition
|
| ︙ | ︙ |
Modified graphspell/str_transform.py from [b4aaad58f4] to [5e51d32779].
| ︙ | ︙ | |||
99 100 101 102 103 104 105 |
nLen2 = len(s2)
for i in range(-1, nLen1+1):
d[i, -1] = i + 1
for j in range(-1, nLen2+1):
d[-1, j] = j + 1
for i in range(nLen1):
for j in range(nLen2):
| | | | 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
nLen2 = len(s2)
for i in range(-1, nLen1+1):
d[i, -1] = i + 1
for j in range(-1, nLen2+1):
d[-1, j] = j + 1
for i in range(nLen1):
for j in range(nLen2):
nCost = 0 if s1[i] == s2[j] else 1
#nCost = distanceBetweenChars(s1[i], s2[j])
d[i, j] = min(
d[i-1, j] + 1, # Deletion
d[i, j-1] + 1, # Insertion
d[i-1, j-1] + nCost, # Substitution
)
if i and j and s1[i] == s2[j-1] and s1[i-1] == s2[j]:
d[i, j] = min(d[i, j], d[i-2, j-2] + nCost) # Transposition
|
| ︙ | ︙ |