Grammalecte  Check-in [63ccb31875]

Overview
Comment:[graphspell][js] fix variables name
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | graphspell | multid
Files: files | file ages | folders
SHA3-256: 63ccb3187581c807e471b49a75965ddd97492e978fefafd37ae44205cd7b9ada
User & Date: olr on 2018-02-13 14:24:01
Other Links: branch diff | manifest | tags
Context
2018-02-13
14:25
[graphspell][js] ibdawg: remove useless var in constructor check-in: 1b2e823757 user: olr tags: graphspell, multid
14:24
[graphspell][js] fix variables name check-in: 63ccb31875 user: olr tags: graphspell, multid
14:23
[graphspell][py] fix variables name check-in: 2bcf7228cc user: olr tags: graphspell, multid
Changes

Modified graphspell-js/spellchecker.js from [ee0b03faf8] to [cfdad9918e].

    21     21   
    22     22   const dDefaultDictionaries = new Map([
    23     23       ["fr", "fr.json"],
    24     24       ["en", "en.json"]
    25     25   ]);
    26     26   
    27     27   
    28         -class Spellchecker {
           28  +class SpellChecker {
    29     29   
    30         -    constructor (sLangCode, mainDic=null, extentedDic=null, personalDic=null, sPath="") {
           30  +    constructor (sLangCode, sPath="", mainDic=null, extentedDic=null, personalDic=null) {
    31     31           // returns true if the main dictionary is loaded
    32     32           this.sLangCode = sLangCode;
    33         -        console.log(sLangCode);
    34         -        console.log(mainDic);
    35     33           if (mainDic === null) {
    36     34               mainDic = dDefaultDictionaries.gl_get(sLangCode, "");
    37     35           }
    38     36           this.oMainDic = this._loadDictionary(mainDic, sPath, true);
    39     37           this.oExtendedDic = this._loadDictionary(extentedDic, sPath);
    40     38           this.oPersonalDic = this._loadDictionary(personalDic, sPath);
    41     39       }
................................................................................
    42     40   
    43     41       _loadDictionary (dictionary, sPath, bNecessary=false) {
    44     42           // returns an IBDAWG object
    45     43           if (dictionary === null) {
    46     44               return null;
    47     45           }
    48     46           try {
    49         -        	if (typeof(require) !== 'undefined') {
    50         -        		console.log(">>>> <resource:>");
           47  +            if (typeof(require) !== 'undefined') {
    51     48                   return new ibdawg.IBDAWG(dictionary);  // dictionary can be a filename or a JSON object
    52     49               } else {
    53         -            	console.log(">>>> no <resource:>");
    54     50                   return new IBDAWG(dictionary, sPath);  // dictionary can be a filename or a JSON object
    55     51               }
    56     52           }
    57     53           catch (e) {
    58         -        	if (bNecessary) {
    59         -        		throw e.message;
    60         -        	}
    61     54               console.log(e.message);
           55  +            if (bNecessary) {
           56  +                throw e.message;
           57  +            }
    62     58               return null;
    63     59           }
    64     60       }
    65     61   
    66     62       setMainDictionary (dictionary) {
    67     63           // returns true if the dictionary is loaded
    68     64           this.oMainDic = this._loadDictionary(dictionary);
................................................................................
    95     91               return true;
    96     92           }
    97     93           return false;
    98     94       }
    99     95   
   100     96       isValid (sWord) {
   101     97           // checks if sWord is valid (different casing tested if the first letter is a capital)
   102         -        if (this.oMainDic.isValid(sToken)) {
           98  +        if (this.oMainDic.isValid(sWord)) {
   103     99               return true;
   104    100           }
   105         -        if (this.oExtendedDic && this.oExtendedDic.isValid(sToken)) {
          101  +        if (this.oExtendedDic && this.oExtendedDic.isValid(sWord)) {
   106    102               return true;
   107    103           }
   108         -        if (this.oPersonalDic && this.oPersonalDic.isValid(sToken)) {
          104  +        if (this.oPersonalDic && this.oPersonalDic.isValid(sWord)) {
   109    105               return true;
   110    106           }
   111    107           return false;
   112    108       }
   113    109   
   114    110       lookup (sWord) {
   115    111           // checks if sWord is in dictionary as is (strict verification)
   116         -        if (this.oMainDic.lookup(sToken)) {
          112  +        if (this.oMainDic.lookup(sWord)) {
   117    113               return true;
   118    114           }
   119         -        if (this.oExtendedDic && this.oExtendedDic.lookup(sToken)) {
          115  +        if (this.oExtendedDic && this.oExtendedDic.lookup(sWord)) {
   120    116               return true;
   121    117           }
   122         -        if (this.oPersonalDic && this.oPersonalDic.lookup(sToken)) {
          118  +        if (this.oPersonalDic && this.oPersonalDic.lookup(sWord)) {
   123    119               return true;
   124    120           }
   125    121           return false;
   126    122       }
   127    123   
   128    124       getMorph (sWord) {
   129    125           // retrieves morphologies list, different casing allowed
   130         -        let lResult = this.oMainDic.getMorph(sToken);
          126  +        let lResult = this.oMainDic.getMorph(sWord);
   131    127           if (this.oExtendedDic) {
   132         -            lResult.extends(this.oExtendedDic.getMorph(sToken));
          128  +            lResult.extends(this.oExtendedDic.getMorph(sWord));
   133    129           }
   134    130           if (this.oPersonalDic) {
   135         -            lResult.extends(this.oPersonalDic.getMorph(sToken));
          131  +            lResult.extends(this.oPersonalDic.getMorph(sWord));
   136    132           }
   137    133           return lResult;
   138    134       }
   139    135   
   140    136       * suggest (sWord, nSuggLimit=10) {
   141    137           // generator: returns 1,2 or 3 lists of suggestions
   142    138           yield this.oMainDic.suggest(sWord, nSuggLimit);