Grammalecte  Check-in [2ef57e5809]

Overview
Comment:[fr] lexicographe: analyse des sous-parties des locutions
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fr | Lexicographe
Files: files | file ages | folders
SHA3-256: 2ef57e580955a487e8f8feaf06f4ef800c367595ff449d5a802ba0125311ae11
User & Date: olr on 2017-10-30 20:50:17
Other Links: branch diff | manifest | tags
Context
2017-10-30
21:08
[fr] lexicographe: màj du CSS check-in: b08a87e4bf user: olr tags: fr, Lexicographe
20:50
[fr] lexicographe: analyse des sous-parties des locutions check-in: 2ef57e5809 user: olr tags: fr, Lexicographe
16:44
[fr] lexicographe: minor changes check-in: 4e84b8a6cf user: olr tags: fr, Lexicographe
Changes

Modified gc_lang/fr/modules-js/lexicographe.js from [f3882fd6a0] to [56a7e98a7a].

345
346
347
348
349
350
351











352
353
354
355
356
357
358
                } else if (oToken.sType !== "SPACE") {
                    aElem.push(oToken);
                }
            }
        }
        return aElem;
    }












    getListOfTokensReduc (sText, bInfo=true) {
        let aTokenList = this.getListOfTokens(sText.replace("'", "’").trim(), false);
        let iKey = 0;
        let aElem = [];
        do {
            let oToken = aTokenList[iKey];







>
>
>
>
>
>
>
>
>
>
>







345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
                } else if (oToken.sType !== "SPACE") {
                    aElem.push(oToken);
                }
            }
        }
        return aElem;
    }

    generateInfoForTokenList (lToken) {
        let aElem = [];
        for (let oToken of lToken) {
            let aRes = this.getInfoForToken(oToken);
            if (aRes) {
                aElem.push(aRes);
            }
        }
        return aElem;
    }

    getListOfTokensReduc (sText, bInfo=true) {
        let aTokenList = this.getListOfTokens(sText.replace("'", "’").trim(), false);
        let iKey = 0;
        let aElem = [];
        do {
            let oToken = aTokenList[iKey];
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388

389
390
391
392
393
394
395
396
397
398

399
400
401
402
403
404
405
                    } else {
                        break;
                    }
                }
            }

            if (sMorphLoc) {
                let sWord = '';
                for (let oTokenWord of aTokenTempList) {
                    sWord += oTokenWord.sValue+' ';
                }
                let oTokenLocution = {
                    'nStart': aTokenTempList[0].nStart,
                    'nEnd': aTokenTempList[aTokenTempList.length-1].nEnd,
                    'sType': "LOC",
                    'sValue': sWord.replace('’ ','’').trim()

                };
                if (bInfo) {
                    let aFormatedTag = [];
                    for (let sTagMulti of sMorphLoc.split('|') ){
                        aFormatedTag.push( this._formatTags(sTagMulti).replace(/( \(él.\))/g,'') );
                    }
                    aElem.push({
                        sType: oTokenLocution.sType,
                        sValue: oTokenLocution.sValue,
                        aLabel: aFormatedTag

                    });
                } else {
                    aElem.push(oTokenLocution);
                }
                iKey = iKey + aTokenTempList.length;
            } else {
                if (bInfo) {







|

|





|
>



|
|




|
>







384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
                    } else {
                        break;
                    }
                }
            }

            if (sMorphLoc) {
                let sValue = '';
                for (let oTokenWord of aTokenTempList) {
                    sValue += oTokenWord.sValue+' ';
                }
                let oTokenLocution = {
                    'nStart': aTokenTempList[0].nStart,
                    'nEnd': aTokenTempList[aTokenTempList.length-1].nEnd,
                    'sType': "LOC",
                    'sValue': sValue.replace('’ ','’').trim(),
                    'aSubToken': aTokenTempList
                };
                if (bInfo) {
                    let aFormatedTag = [];
                    for (let sTagLoc of sMorphLoc.split('|') ){
                        aFormatedTag.push( this._formatTags(sTagLoc).replace(/( \(él.\))/g,'') );
                    }
                    aElem.push({
                        sType: oTokenLocution.sType,
                        sValue: oTokenLocution.sValue,
                        aLabel: aFormatedTag,
                        aSubElem: this.generateInfoForTokenList(aTokenTempList)
                    });
                } else {
                    aElem.push(oTokenLocution);
                }
                iKey = iKey + aTokenTempList.length;
            } else {
                if (bInfo) {

Modified gc_lang/fr/webext/content_scripts/panel_lxg.css from [ccbb028287] to [c6d538bdb2].

31
32
33
34
35
36
37









38
39
40
41
42
43
44
    border-radius: 5px;
    text-align: center;
    font-size: 20px;
}

.grammalecte_lxg_token_block  {
    margin: 4px 0;









}
.grammalecte_lxg_token {
    display: inline-block;
    background-color: hsl(150, 0%, 50%);
    color: hsl(0, 0%, 96%);
    padding: 2px 5px;
    border-radius: 2px;







>
>
>
>
>
>
>
>
>







31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    border-radius: 5px;
    text-align: center;
    font-size: 20px;
}

.grammalecte_lxg_token_block  {
    margin: 4px 0;
}
.grammalecte_lxg_token_subblock {
    margin: 2px 0 2px 20px;
    padding: 5px;
    border-left: 4px solid hsl(210, 50%, 50%);
    background-color: hsl(210, 10%, 90%);
}
.grammalecte_lxg_token_descr {
    padding: 2px;
}
.grammalecte_lxg_token {
    display: inline-block;
    background-color: hsl(150, 0%, 50%);
    color: hsl(0, 0%, 96%);
    padding: 2px 5px;
    border-radius: 2px;

Modified gc_lang/fr/webext/content_scripts/panel_lxg.js from [d3537b8dce] to [524fe4ff4b].

25
26
27
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
    }

    addMessage (sMessage) {
        let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_message", textContent: sMessage});
        this._xContentNode.appendChild(xNode);
    }

    addListOfTokens (lTokens) {
        try {
            if (lTokens) {
                this._nCount += 1;
                let xNodeDiv = oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_of_tokens"});
                xNodeDiv.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_num", textContent: this._nCount}));
                for (let oToken of lTokens) {
                    xNodeDiv.appendChild(this._createTokenNode(oToken));
                }
                this._xContentNode.appendChild(xNodeDiv);
            }


































        }
        catch (e) {
            showError(e);
        }
    }

    _createTokenNode (oToken) {
        let xTokenNode = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_block"});
        xTokenNode.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token grammalecte_lxg_token_" + oToken.sType, textContent: oToken.sValue}));
        xTokenNode.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_colon", textContent: ":"}));
        if (oToken.aLabel.length === 1) {
            xTokenNode.appendChild(document.createTextNode(oToken.aLabel[0]));
        } else {
            let xTokenList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_list"});
            for (let sLabel of oToken.aLabel) {
                xTokenList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem", textContent: "• " + sLabel}));
            }
            xTokenNode.appendChild(xTokenList);
        }
        return xTokenNode;
    }

    setHidden (sClass, bHidden) {
        for (let xNode of document.getElementsByClassName(sClass)) {
            xNode.hidden = bHidden;
        }
    }
}







|

|

|
|
|
|

|

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>






<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






25
26
27
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
76
77
78
79
80
81
82
















83
84
85
86
87
88
    }

    addMessage (sMessage) {
        let xNode = oGrammalecte.createNode("div", {className: "grammalecte_panel_message", textContent: sMessage});
        this._xContentNode.appendChild(xNode);
    }

    addListOfTokens (lToken) {
        try {
            if (lToken) {
                this._nCount += 1;
                let xTokenList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_of_tokens"});
                xTokenList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_list_num", textContent: this._nCount}));
                for (let oToken of lToken) {
                    xTokenList.appendChild(this._createTokenBlock(oToken));
                }
                this._xContentNode.appendChild(xTokenList);
            }
        }
        catch (e) {
            showError(e);
        }
    }

    _createTokenBlock (oToken) {
        let xTokenBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_block"});
        xTokenBlock.appendChild(this._createTokenDescr(oToken));
        if (oToken.aSubElem) {
            let xSubBlock = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_subblock"});
            for (let oSubElem of oToken.aSubElem) {
                xSubBlock.appendChild(this._createTokenDescr(oSubElem));
            }
            xTokenBlock.appendChild(xSubBlock);
        }
        return xTokenBlock;
    }

    _createTokenDescr (oToken) {
        try {
            let xTokenDescr = oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_descr"});
            xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token grammalecte_lxg_token_" + oToken.sType, textContent: oToken.sValue}));
            xTokenDescr.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_token_colon", textContent: ":"}));
            if (oToken.aLabel.length === 1) {
                xTokenDescr.appendChild(document.createTextNode(oToken.aLabel[0]));
            } else {
                let xMorphList = oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_list"});
                for (let sLabel of oToken.aLabel) {
                    xMorphList.appendChild(oGrammalecte.createNode("div", {className: "grammalecte_lxg_morph_elem", textContent: "• " + sLabel}));
                }
                xTokenDescr.appendChild(xMorphList);
            }
            return xTokenDescr;
        }
        catch (e) {
            showError(e);
        }
    }

















    setHidden (sClass, bHidden) {
        for (let xNode of document.getElementsByClassName(sClass)) {
            xNode.hidden = bHidden;
        }
    }
}