Grammalecte  Check-in [3996597b39]

Overview
Comment:[fr][js] lexicographe: nettoyage
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fr | kill_innerHTML
Files: files | file ages | folders
SHA3-256: 3996597b39cf2b84fdaeaf2bf89958569b5b919df19792afe1f6082fbaefe469
User & Date: olr on 2017-07-13 07:12:23
Original Comment: [fr] lexicographe: nettoyage
Other Links: branch diff | manifest | tags
Context
2017-07-13
16:44
[fx][js] gc_panel revamping (part 1) check-in: a83903f529 user: olr tags: fx, kill_innerHTML
07:12
[fr][js] lexicographe: nettoyage check-in: 3996597b39 user: olr tags: fr, kill_innerHTML
07:08
[core][js] tokenizer: yield separator one by one check-in: 492169bd6f user: olr tags: core, kill_innerHTML
Changes

Modified gc_lang/fr/modules-js/lexicographe.js from [52486b3ce8] to [673a7bbf6a].

   244    244           }
   245    245           catch (e) {
   246    246               helpers.logerror(e);
   247    247           }
   248    248           return null;
   249    249       };
   250    250   
   251         -    getHTMLForText (sText) {
   252         -        // deprecated
   253         -        sText = sText.replace(/[.,.?!:;…\/()\[\]“”«»"„{}–—#+*<>%=\n]/g, " ").replace(/\s+/g, " ");
   254         -        let iStart = 0;
   255         -        let iEnd = 0;
   256         -        let sHtml = '<div class="paragraph">\n';
   257         -        while ((iEnd = sText.indexOf(" ", iStart)) !== -1) {
   258         -            sHtml += this.getHTMLForToken(sText.slice(iStart, iEnd));
   259         -            iStart = iEnd + 1;
   260         -        }
   261         -        sHtml += this.getHTMLForToken(sText.slice(iStart));
   262         -        return sHtml + '</div>\n';
   263         -    };
   264         -
   265         -    getHTMLForToken (sWord) {
   266         -        // deprecated
   267         -        try {
   268         -            if (!sWord) {
   269         -                return "";
   270         -            }
   271         -            if (sWord._count("-") > 4) {
   272         -                return '<p><b class="mbok">' + sWord + "</b> <s>:</s> élément complexe indéterminé</p>\n";
   273         -            }
   274         -            if (sWord._isDigit()) {
   275         -                return '<p><b class="nb">' + sWord + "</b> <s>:</s> nombre</p>\n";
   276         -            }
   277         -
   278         -            let sHtml = "";
   279         -            // préfixes élidés
   280         -            let m = this._zElidedPrefix.exec(sWord);
   281         -            if (m !== null) {
   282         -                sWord = m[2];
   283         -                sHtml += "<p><b>" + m[1] + "’</b> <s>:</s> " + _dPFX.get(m[1].toLowerCase()) + " </p>\n";
   284         -            }
   285         -            // mots composés
   286         -            let m2 = this._zCompoundWord.exec(sWord);
   287         -            if (m2 !== null) {
   288         -                sWord = m2[1];
   289         -            }
   290         -            // Morphologies
   291         -            let lMorph = this.oDict.getMorph(sWord);
   292         -            if (lMorph.length === 1) {
   293         -                sHtml += "<p><b>" + sWord + "</b> <s>:</s> " + this._formatTags(lMorph[0]) + "</p>\n";
   294         -            } else if (lMorph.length > 1) {
   295         -                sHtml += "<p><b>" + sWord + "</b><ul><li>" + [for (s of lMorph) if (s.includes(":")) this._formatTags(s)].join(" </li><li> ") + "</li></ul></p>\n";
   296         -            } else {
   297         -                sHtml += '<p><b class="unknown">' + sWord + "</b> <s>:</s>  absent du dictionnaire<p>\n";
   298         -            }
   299         -            // suffixe d’un mot composé
   300         -            if (m2) {
   301         -                sHtml += "<p>-<b>" + m2[2] + "</b> <s>:</s> " + this._formatSuffix(m2[2].toLowerCase()) + "</p>\n";
   302         -            }
   303         -            // Verbes
   304         -            //let aVerb = new Set([ for (s of lMorph) if (s.includes(":V")) s.slice(1, s.indexOf(" ")) ]);
   305         -            return sHtml;
   306         -        }
   307         -        catch (e) {
   308         -            helpers.logerror(e);
   309         -            return "#erreur";
   310         -        }
   311         -    };
   312         -
   313    251       _formatTags (sTags) {
   314    252           let sRes = "";
   315    253           sTags = sTags.replace(/V([0-3][ea]?)[itpqnmr_eaxz]+/, "V$1");
   316    254           let m;
   317    255           while ((m = this._zTag.exec(sTags)) !== null) {
   318    256               sRes += _dTAGS.get(m[0]);
   319    257               if (sRes.length > 100) {