Grammalecte  Diff

Differences From Artifact [378b08526d]:

To Artifact [b9ee777056]:


82
83
84
85
86
87
88
89

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

107
108
109
110
111
112
113
82
83
84
85
86
87
88

89





90
91
92
93
94






95
96
97
98
99
100
101
102
103







-
+
-
-
-
-
-





-
-
-
-
-
-

+







function parse (sText, sLang, bDebug, bContext) {
    let aGrammErr = gce.parse(sText, sLang, bDebug, bContext);
    return JSON.stringify(aGrammErr);
}

function parseAndSpellcheck (sText, sLang, bDebug, bContext) {
    let aGrammErr = gce.parse(sText, sLang, bDebug, bContext);
    let aSpellErr = [];
    let aSpellErr = oTokenizer.getSpellingErrors(sText, oDict);
    for (let oToken of oTokenizer.genTokens(sText)) {
        if (oToken.sType === 'WORD' && !oDict.isValidToken(oToken.sValue)) {
            aSpellErr.push(oToken);
        }
    }
    return JSON.stringify({ aGrammErr: aGrammErr, aSpellErr: aSpellErr });
}

function parseAndTag (sText, iParagraph, sLang, bDebug) {
    sText = text.addHtmlEntities(sText);
    let aSpellErr = [];
    for (let oToken of oTokenizer.genTokens(sText)) {
        if (oToken.sType === 'WORD' && !oDict.isValidToken(oToken.sValue)) {
            aSpellErr.push(oToken);
        }
    }
    let aGrammErr = gce.parse(sText, sLang, bDebug);
    let aSpellErr = oTokenizer.getSpellingErrors(sText, oDict);
    let sHtml = text.tagParagraph(sText, iParagraph, aGrammErr, aSpellErr);
    return sHtml;
}

function parseAndGenerateParagraph (sText, iParagraph, sLang, bDebug) {
    return text.createHTMLBlock(parseAndTag(sText, iParagraph, sLang, bDebug), iParagraph);
}
153
154
155
156
157
158
159
160
161
162
















143
144
145
146
147
148
149



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165







-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
    gce.setOptions(dMemoOptions);
    return sAllRes;
}


// Lexicographer

function analyzeWords (sText) {
    return oLxg.analyzeText(sText);
}
function getListOfElements (sText) {
    try {
        let aElem = [];
        let aRes = null;
        for (let oToken of oTokenizer.genTokens(sText)) {
            aRes = oLxg.getInfoForToken(oToken);
            if (aRes) {
                aElem.push(aRes);
            }
        }
        return JSON.stringify(aElem);
    }
    catch (e) {
        helpers.logerror(e);
    }
}