Grammalecte  Check-in [dbcb7ad1a9]

Overview
Comment:[graphspell] suggest: code simplification
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: dbcb7ad1a913d237dad5b1320f959da55962cf340a7db4214f0324537612ed19
User & Date: olr on 2019-09-08 15:59:40
Other Links: manifest | tags
Context
2019-09-08
16:33
[graphspell] suggest: don’t split words when only one letter (with exceptions) check-in: 5f6937c0c1 user: olr tags: trunk, graphspell
15:59
[graphspell] suggest: code simplification check-in: dbcb7ad1a9 user: olr tags: trunk, graphspell
2019-09-07
22:44
[build] use fileFile with files copied from folders check-in: 86a861f07a user: olr tags: trunk, build
Changes

Modified graphspell-js/ibdawg.js from [04aaec821c] to [ad7773e0f2].

264
265
266
267
268
269
270
271
272
273
274

275
276
277
278
279
280
281
264
265
266
267
268
269
270




271
272
273
274
275
276
277
278







-
-
-
-
+







        }
        if (sWord.charAt(0).gl_isUpperCase()) {
            if (sWord.length > 1) {
                if (sWord.gl_isTitle()) {
                    return !!this.lookup(sWord.toLowerCase());
                }
                if (sWord.gl_isUpperCase()) {
                    if (this.bAcronymValid) {
                        return true;
                    }
                    return !!(this.lookup(sWord.toLowerCase()) || this.lookup(sWord.gl_toCapitalize()));
                    return !!(this.bAcronymValid || this.lookup(sWord.toLowerCase()) || this.lookup(sWord.gl_toCapitalize()));
                }
                return !!this.lookup(sWord.slice(0, 1).toLowerCase() + sWord.slice(1));
            }
            return !!this.lookup(sWord.toLowerCase());
        }
        if (sWord.slice(0,1).gl_isDigit()) {
            return true;

Modified graphspell/ibdawg.py from [0b64fb2804] to [0e7456a664].

1
2
3
4
5
6

7
8
9
10
11
12
13
1
2
3
4
5

6
7
8
9
10
11
12
13





-
+







#!python3

"""
INDEXABLE BINARY DIRECT ACYCLIC WORD GRAPH
Implementation of a spellchecker as a transducer (storing transformation code to get lemma and morphologies)
and a spell suggestion mechanim
and a spell suggestion mechanism
"""

import traceback
import pkgutil
import re
from functools import wraps
import time
262
263
264
265
266
267
268
269
270
271

272
273
274
275
276
277
278
262
263
264
265
266
267
268



269
270
271
272
273
274
275
276







-
-
-
+







        if self.lookup(sWord):
            return True
        if sWord[0:1].isupper():
            if len(sWord) > 1:
                if sWord.istitle():
                    return self.lookup(sWord.lower())
                if sWord.isupper():
                    if self.bAcronymValid:
                        return True
                    return self.lookup(sWord.lower()) or self.lookup(sWord.capitalize())
                    return self.bAcronymValid or self.lookup(sWord.lower()) or self.lookup(sWord.capitalize())
                return self.lookup(sWord[:1].lower() + sWord[1:])
            return self.lookup(sWord.lower())
        if sWord[0:1].isdigit():
            return True
        return False

    def lookup (self, sWord):