Grammalecte  Check-in [35abf9fb76]

Overview
Comment:[core] ibdawg: reduce hard replacements in suggestion mechanism
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | core
Files: files | file ages | folders
SHA3-256: 35abf9fb76e716d1f5aacbf3394a3319df9af7dac2ed98d27b88d15c6042dbe4
User & Date: olr on 2017-10-24 12:05:31
Other Links: manifest | tags
Context
2017-10-24
22:24
[core] ibdawg: suggestion mechanism > exclude some suffixes (ß) check-in: 5fbb7ec853 user: olr tags: core, trunk
12:05
[core] ibdawg: reduce hard replacements in suggestion mechanism check-in: 35abf9fb76 user: olr tags: core, trunk
11:59
[core] fix tokentizer: two similar group name in regex check-in: 78199c4006 user: olr tags: core, trunk
Changes

Modified gc_core/js/ibdawg.js from [987b525ef9] to [330301cb59].

   187    187           }
   188    188           return l;
   189    189       }
   190    190   
   191    191       suggest (sWord, nMaxSugg=10) {
   192    192           // returns a array of suggestions for <sWord>
   193    193           let nMaxDel = Math.floor(sWord.length / 5);
   194         -        let nMaxHardRepl = Math.max(Math.floor((sWord.length - 5) / 3), 1);
          194  +        let nMaxHardRepl = Math.max(Math.floor((sWord.length - 5) / 4), 1);
   195    195           let aSugg = this._suggest(sWord, nMaxDel, nMaxHardRepl);
   196    196           if (sWord.gl_isTitle()) {
   197    197               aSugg.gl_update(this._suggest(sWord.toLowerCase(), nMaxDel, nMaxHardRepl));
   198    198           }
   199    199           else if (sWord.gl_isLowerCase()) {
   200    200               aSugg.gl_update(this._suggest(sWord.gl_toCapitalize(), nMaxDel, nMaxHardRepl));
   201    201           }

Modified gc_core/py/ibdawg.py from [bb15f40868] to [d3aa940937].

   187    187                   l.extend(self.morph(sWord.capitalize()))
   188    188           return l
   189    189   
   190    190       def suggest (self, sWord, nMaxSugg=10):
   191    191           "returns a set of suggestions for <sWord>"
   192    192           aSugg = set()
   193    193           nMaxDel = len(sWord) // 5
   194         -        nMaxHardRepl = max((len(sWord) - 5) // 3, 1)
          194  +        nMaxHardRepl = max((len(sWord) - 5) // 4, 1)
   195    195           aSugg.update(self._suggest(sWord, nMaxDel=nMaxDel, nMaxHardRepl=nMaxHardRepl))
   196    196           if sWord.istitle():
   197    197               aSugg.update(self._suggest(sWord.lower(), nMaxDel=nMaxDel, nMaxHardRepl=nMaxHardRepl))
   198    198               aSugg = set(map(lambda sSugg: sSugg.title(), aSugg))
   199    199           elif sWord.islower():
   200    200               aSugg.update(self._suggest(sWord.title(), nMaxDel=nMaxDel, nMaxHardRepl=nMaxHardRepl))
   201    201           if not aSugg: