Overview
| Comment: | [graphspell][py] spellchecker: dictionary object can be used to initialize IBDAWG |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | graphspell | multid |
| Files: | files | file ages | folders |
| SHA3-256: |
0cd3bfee2d9d62e871886d71495b48c8 |
| User & Date: | olr on 2018-02-28 18:27:18 |
| Other Links: | branch diff | manifest | tags |
Context
|
2018-02-28
| ||
| 18:43 | [lo] use user dictionary check-in: 3879004037 user: olr tags: lo, multid | |
| 18:27 | [graphspell][py] spellchecker: dictionary object can be used to initialize IBDAWG check-in: 0cd3bfee2d user: olr tags: graphspell, multid | |
| 17:24 | [lo] lexicon editor: prevent deleting unexistant rows check-in: b156d2110e user: olr tags: lo, multid | |
Changes
Modified graphspell/spellchecker.py from [4787045da6] to [aaa0229431].
| ︙ | ︙ | |||
28 29 30 31 32 33 34 |
if not sfMainDic:
sfMainDic = dDefaultDictionaries.get(sLangCode, "")
self.oMainDic = self._loadDictionary(sfMainDic, True)
self.oExtendedDic = self._loadDictionary(sfExtendedDic)
self.oPersonalDic = self._loadDictionary(sfPersonalDic)
self.oTokenizer = None
| | | | | | | | | | | | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
if not sfMainDic:
sfMainDic = dDefaultDictionaries.get(sLangCode, "")
self.oMainDic = self._loadDictionary(sfMainDic, True)
self.oExtendedDic = self._loadDictionary(sfExtendedDic)
self.oPersonalDic = self._loadDictionary(sfPersonalDic)
self.oTokenizer = None
def _loadDictionary (self, source, bNecessary=False):
"returns an IBDAWG object"
if not source:
return None
try:
return ibdawg.IBDAWG(source)
except Exception as e:
if bNecessary:
raise Exception(str(e), "Error: <" + str(source) + "> not loaded.")
print("Error: <" + str(source) + "> not loaded.")
traceback.print_exc()
return None
def loadTokenizer (self):
self.oTokenizer = tokenizer.Tokenizer(self.sLangCode)
def getTokenizer (self):
if not self.oTokenizer:
self.loadTokenizer()
return self.oTokenizer
def setMainDictionary (self, source):
"returns True if the dictionary is loaded"
self.oMainDic = self._loadDictionary(source)
return bool(self.oMainDic)
def setExtendedDictionary (self, source):
"returns True if the dictionary is loaded"
self.oExtendedDic = self._loadDictionary(source)
return bool(self.oExtendedDic)
def setPersonalDictionary (self, source):
"returns True if the dictionary is loaded"
self.oPersonalDic = self._loadDictionary(source)
return bool(self.oPersonalDic)
# parse text functions
def parseParagraph (self, sText, bSpellSugg=False):
if not self.oTokenizer:
self.loadTokenizer()
|
| ︙ | ︙ |