Grammalecte  Check-in [0a4c113f2c]

Overview
Comment:[graphspell] add date to JSON dictionary
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | graphspell
Files: files | file ages | folders
SHA3-256: 0a4c113f2cdb70e724bc160210b9476e0a9370c5f611d1c9efde75b904dc461f
User & Date: olr on 2018-02-10 13:53:16
Other Links: manifest | tags
Context
2018-02-10
20:01
[graphspell] dawg: consistency check-in: 665bb08741 user: olr tags: graphspell, trunk
13:53
[graphspell] add date to JSON dictionary check-in: 0a4c113f2c user: olr tags: graphspell, trunk
13:35
[fx] lexicon editor: show date check-in: c453c3dbb7 user: olr tags: fx, trunk
Changes

Modified graphspell-js/dawg.js from [3e8b9a6207] to [f93ec574ae].

398
399
400
401
402
403
404

405
406
407
408
409
410
411
...
416
417
418
419
420
421
422









423
424
425
426
427
428
429
            for (let oNode of this.dMinimizedNodes.values()) {
                sByDic += oNode.convToBytes1(this.nBytesArc, this.nBytesNodeAddress);
            }
        }
        let oJSON = {
            "sName": this.sName,
            "nVersion": nMethod,

            "sHeader": this.sHeader + nMethod + "/",
            "lArcVal": this.lArcVal,
            "nArcVal": this.nArcVal,
            "byDic": sByDic,  // binary word graph
            "sLang": this.sLang,
            "nChar": this.nChar,
            "nBytesArc": this.nBytesArc,
................................................................................
            "nAff": this.nAff,
            "cStemming": this.cStemming,
            "nTag": this.nTag,
            "dChar": helpers.mapToObject(this.dChar),
            "nBytesOffset": 1
        };
        return oJSON;









    }
}


const oNodeCounter = {
    nNextId: 0,








>







 







>
>
>
>
>
>
>
>
>







398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
...
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
            for (let oNode of this.dMinimizedNodes.values()) {
                sByDic += oNode.convToBytes1(this.nBytesArc, this.nBytesNodeAddress);
            }
        }
        let oJSON = {
            "sName": this.sName,
            "nVersion": nMethod,
            "sDate": this._getDate(),
            "sHeader": this.sHeader + nMethod + "/",
            "lArcVal": this.lArcVal,
            "nArcVal": this.nArcVal,
            "byDic": sByDic,  // binary word graph
            "sLang": this.sLang,
            "nChar": this.nChar,
            "nBytesArc": this.nBytesArc,
................................................................................
            "nAff": this.nAff,
            "cStemming": this.cStemming,
            "nTag": this.nTag,
            "dChar": helpers.mapToObject(this.dChar),
            "nBytesOffset": 1
        };
        return oJSON;
    },

    _getDate () {
        let oDate = new Date();
        let sMonth = (oDate.getMonth() + 1).toString().padStart(2, "0"); // Month+1: Because JS always sucks somehow.
        let sDay = (oDate.getDay()).toString().padStart(2, "0");
        let sHours = (oDate.getHours()).toString().padStart(2, "0");
        let sMinutes = (oDate.getMinutes()).toString().padStart(2, "0");
        return `${oDate.getFullYear()}-${sMonth}-${sDay}, ${sHours}:${sMinutes}`;
    }
}


const oNodeCounter = {
    nNextId: 0,

Modified graphspell-js/ibdawg.js from [04460c4785] to [f5e06268c1].

171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
        }
        //console.log(this.getInfo());
        this.bOptNumSigle = true;
        this.bOptNumAtLast = false;
    }

    getInfo () {
        return  `  Language: ${this.sLang}      Version: ${this.nVersion}      Stemming: ${this.cStemming}FX\n` +
                `  Arcs values:  ${this.nArcVal} = ${this.nChar} characters,  ${this.nAff} affixes,  ${this.nTag} tags\n` +
                `  Dictionary: ${this.nEntries} entries,    ${this.nNode} nodes,   ${this.nArc} arcs\n` +
                `  Address size: ${this.nBytesNodeAddress} bytes,  Arc size: ${this.nBytesArc} bytes\n`;
    }

    isValidToken (sToken) {
        // checks if sToken is valid (if there is hyphens in sToken, sToken is split, each part is checked)







|







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
        }
        //console.log(this.getInfo());
        this.bOptNumSigle = true;
        this.bOptNumAtLast = false;
    }

    getInfo () {
        return  `  Language: ${this.sLang}   Version: ${this.nVersion}   Date: ${this.sDate}   Stemming: ${this.cStemming}FX\n` +
                `  Arcs values:  ${this.nArcVal} = ${this.nChar} characters,  ${this.nAff} affixes,  ${this.nTag} tags\n` +
                `  Dictionary: ${this.nEntries} entries,    ${this.nNode} nodes,   ${this.nArc} arcs\n` +
                `  Address size: ${this.nBytesNodeAddress} bytes,  Arc size: ${this.nBytesArc} bytes\n`;
    }

    isValidToken (sToken) {
        // checks if sToken is valid (if there is hyphens in sToken, sToken is split, each part is checked)

Modified graphspell/ibdawg.py from [575cbfa96d] to [cf92ef19a3].

1
2
3
4
5
6
7

8
9
10
11
12
13
14
...
164
165
166
167
168
169
170

171
172
173
174
175
176
177
#!python3

import os
import traceback
import pkgutil
import re
from functools import wraps

import time

#import logging
#logging.basicConfig(filename="suggestions.log", level=logging.DEBUG)

from . import str_transform as st
from . import char_player as cp
................................................................................
        import json
        with open(spfDest, "w", encoding="utf-8", newline="\n") as hDst:
            if bInJSModule:
                hDst.write('// JavaScript\n// Generated data (do not edit)\n\n"use strict";\n\nconst dictionary = ')
            hDst.write(json.dumps({
                            "sName": self.sName,
                            "nVersion": self.nVersion,

                            "sHeader": self.sHeader,
                            "lArcVal": self.lArcVal,
                            "nArcVal": self.nArcVal,
                            # JavaScript is a pile of shit, so Mozilla’s JS parser don’t like file bigger than 4 Mb!
                            # So, if necessary, we use an hexadecimal string, that we will convert later in Firefox’s extension.
                            # https://github.com/mozilla/addons-linter/issues/1361
                            "byDic": self.byDic.hex()  if bBinaryDictAsHexString  else [ e  for e in self.byDic ],







>







 







>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
...
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
#!python3

import os
import traceback
import pkgutil
import re
from functools import wraps
import datetime
import time

#import logging
#logging.basicConfig(filename="suggestions.log", level=logging.DEBUG)

from . import str_transform as st
from . import char_player as cp
................................................................................
        import json
        with open(spfDest, "w", encoding="utf-8", newline="\n") as hDst:
            if bInJSModule:
                hDst.write('// JavaScript\n// Generated data (do not edit)\n\n"use strict";\n\nconst dictionary = ')
            hDst.write(json.dumps({
                            "sName": self.sName,
                            "nVersion": self.nVersion,
                            "sDate": str(datetime.datetime.now())[:-7],
                            "sHeader": self.sHeader,
                            "lArcVal": self.lArcVal,
                            "nArcVal": self.nArcVal,
                            # JavaScript is a pile of shit, so Mozilla’s JS parser don’t like file bigger than 4 Mb!
                            # So, if necessary, we use an hexadecimal string, that we will convert later in Firefox’s extension.
                            # https://github.com/mozilla/addons-linter/issues/1361
                            "byDic": self.byDic.hex()  if bBinaryDictAsHexString  else [ e  for e in self.byDic ],