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):
|