Overview
| Comment: | [graphspell][js] dawg: use <Set> to prevent duplicate entries |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | graphspell | multid |
| Files: | files | file ages | folders |
| SHA3-256: |
52593d2f387b1931db363efbb7d46370 |
| User & Date: | olr on 2018-03-20 13:57:31 |
| Original Comment: | [graphspell][js] dawg: use <set> to prevent duplicate entries |
| Other Links: | branch diff | manifest | tags |
Context
|
2018-03-20
| ||
| 18:06 | [graphspell] spellchecker: activate/deactivate dictionaries check-in: 09254c7f4b user: olr tags: graphspell, multid | |
| 13:57 | [graphspell][js] dawg: use <Set> to prevent duplicate entries check-in: 52593d2f38 user: olr tags: graphspell, multid | |
| 13:28 | [graphspell][py] dawg: use <set> to prevent duplicate entries check-in: 9e16a5b1a9 user: olr tags: graphspell, multid | |
Changes
Modified graphspell-js/dawg.js from [efda06dcfb] to [e2cd530970].
| ︙ | ︙ | |||
76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
}
dTagOccur.set(sTag, dTagOccur.gl_get(sTag, 0) + 1);
lEntry.push([sFlex, dAff.get(sAff), dTag.get(sTag)]);
}
if (lEntry.length == 0) {
throw "Error. Empty lexicon";
}
// Preparing DAWG
console.log(" > Preparing list of words");
let lVal = lChar.concat(lAff).concat(lTag);
let lWord = [];
for (let [sFlex, iAff, iTag] of lEntry) {
let lTemp = [];
| > > > > | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
}
dTagOccur.set(sTag, dTagOccur.gl_get(sTag, 0) + 1);
lEntry.push([sFlex, dAff.get(sAff), dTag.get(sTag)]);
}
if (lEntry.length == 0) {
throw "Error. Empty lexicon";
}
lEntry = [...new Set(lEntry.map(e => JSON.stringify(e)))].map(s => JSON.parse(s));
// Set can’t distinguish similar lists, so we transform list item in string given to the Set
// then we transform items in list a new.
// Preparing DAWG
console.log(" > Preparing list of words");
let lVal = lChar.concat(lAff).concat(lTag);
let lWord = [];
for (let [sFlex, iAff, iTag] of lEntry) {
let lTemp = [];
|
| ︙ | ︙ |