Grammalecte  Check-in [6076fe388a]

Overview
Comment:[njs] Change directory for modules
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | njs | nodejs
Files: files | file ages | folders
SHA3-256: 6076fe388a857d79188538fcd8c0f6a2be888bcdee8c8d76b0b9aefd1048032d
User & Date: IllusionPerdu on 2018-10-15 15:54:09
Original Comment: [js] Change directory for modules
Other Links: branch diff | manifest | tags
Context
2018-10-15
15:56
[njs] Add files for modules check-in: 5b89e2f4fe user: IllusionPerdu tags: njs, nodejs
15:54
[njs] Change directory for modules check-in: 6076fe388a user: IllusionPerdu tags: njs, nodejs
11:44
[njs] Remove example use check-in: e1e718ac39 user: IllusionPerdu tags: njs, nodejs
Changes

Name change from gc_lang/fr/nodejs/gramma-cli.bat to gc_lang/fr/nodejs/cli/bin/gramma-cli.bat.

Modified gc_lang/fr/nodejs/cli/bin/gramma-cli.js from [af7143ae7f] to [952ea8ac82].




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21



// Gramma-Cli
// Grammalect client pour node

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, console */

/*
Doc :
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
https://stackoverflow.com/questions/41058569/what-is-the-difference-between-const-and-const-in-javascript
*/

const argCmd = require("./minimist.js")(process.argv.slice(2));
const { performance } = require("perf_hooks");

var repJson = false;
var repPerf = false;

var sBufferConsole = "";
var sCmdToExec = "";
>
>
>













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /usr/bin/env node
// -*- js -*-

// Gramma-Cli
// Grammalect client pour node

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, console */

/*
Doc :
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
https://stackoverflow.com/questions/41058569/what-is-the-difference-between-const-and-const-in-javascript
*/

const argCmd = require("../lib/minimist.js")(process.argv.slice(2));
const { performance } = require("perf_hooks");

var repJson = false;
var repPerf = false;

var sBufferConsole = "";
var sCmdToExec = "";
419
420
421
422
423
424
425
426


427
428
429
430
431
432
433
434
435
436
    });
    return [hits && hits.length ? hits : cmdAll, line];
}

if (process.argv.length <= 2) {
    console.log(actionToExec({help:true}));
} else {
    var GrammarChecker = require("./api.js");


    var oGrammarChecker = new GrammarChecker.GrammarChecker(
        ["Grammalecte", "Graphspell", "TextFormatter", "Lexicographer", "Tokenizer"],
        __dirname + "/grammalecte/",
        "fr"
    );

    if (argCmd.server) {
        var http = require("http");
        var url = require("url");
        var querystring = require("querystring");







|
>
>


<







422
423
424
425
426
427
428
429
430
431
432
433

434
435
436
437
438
439
440
    });
    return [hits && hits.length ? hits : cmdAll, line];
}

if (process.argv.length <= 2) {
    console.log(actionToExec({help:true}));
} else {
    //var GrammarChecker = require("./api.js");
    //console.log(module.paths);
    var GrammarChecker = require("grammalecte");
    var oGrammarChecker = new GrammarChecker.GrammarChecker(
        ["Grammalecte", "Graphspell", "TextFormatter", "Lexicographer", "Tokenizer"],

        "fr"
    );

    if (argCmd.server) {
        var http = require("http");
        var url = require("url");
        var querystring = require("querystring");

Name change from gc_lang/fr/nodejs/script.verf to gc_lang/fr/nodejs/cli/data/script.gramma.

Name change from gc_lang/fr/nodejs/minimist.js to gc_lang/fr/nodejs/cli/lib/minimist.js.

Modified gc_lang/fr/nodejs/cli/readme.md from [92fc7afa39] to [595855cb69].

1
2
3
4
5
6
7
8
9






10
11
12
13
14
15
16
# Client/Serveur de Grammalecte pour NodeJS

## Aide

Il y a trois modes de fonctionnement: client / client intératif / serveur.

* Client intéractif: «gramma-cli -i».
* Client: «gramma-cli --command \"mot/texte\"».
* Serveur: lancé avec la commande «gramma-cli --server --port NumPort».







## Commandes

* help           : Affichie les informations que vous lisez ;)
* perf           : Permet d'afficher le temps d'exécution des commandes.
* json           : Réponse en format format json.
* exit           : Client intéractif: Permet de le quitter.


|






>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Client/Serveur de Grammalecte pour NodeJS

## Informations

Il y a trois modes de fonctionnement: client / client intératif / serveur.

* Client intéractif: «gramma-cli -i».
* Client: «gramma-cli --command \"mot/texte\"».
* Serveur: lancé avec la commande «gramma-cli --server --port NumPort».

## Installation

```
npm install grammalecte-cli -g
```

## Commandes

* help           : Affichie les informations que vous lisez ;)
* perf           : Permet d'afficher le temps d'exécution des commandes.
* json           : Réponse en format format json.
* exit           : Client intéractif: Permet de le quitter.
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
 ├ salait
 ├ salut
 └ salât
GrammaJS> exit
```

Exemple pour les vérifications portant sur un texte:

```
CMD> gramma-cli -i
Bienvenu sur Grammalecte pour NodeJS!!!
GrammaJS> format
> salut,les copains!!!
> vous allez bien ?
> /format
Mise en forme:
salut, les copains!!!
vous allez bien ?
GrammaJS> exit
```

**Note : Vous pouvez vérifier tout un fichier avec pour chaque ligne ayant une commande :**
**cat script.verf | gramma-cli -i**


## Client

Exemple simple:

```
CMD> gramma-cli --spell saluti
Le mot saluti innexistant

CMD>
```

Exemple faisant plusiseurs action:

```
CMD> gramma-cli --lemma --morph --suggest --text salut
Morph possible de: salut
 └ >salut/:N:m:s/*
Lemma possible de: salut
 └ salut
Suggestion possible de: salut







>
















<



>








>







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
89
90
91
92
93
94
 ├ salait
 ├ salut
 └ salât
GrammaJS> exit
```

Exemple pour les vérifications portant sur un texte:

```
CMD> gramma-cli -i
Bienvenu sur Grammalecte pour NodeJS!!!
GrammaJS> format
> salut,les copains!!!
> vous allez bien ?
> /format
Mise en forme:
salut, les copains!!!
vous allez bien ?
GrammaJS> exit
```

**Note : Vous pouvez vérifier tout un fichier avec pour chaque ligne ayant une commande :**
**cat script.verf | gramma-cli -i**


## Client

Exemple simple:

```
CMD> gramma-cli --spell saluti
Le mot saluti innexistant

CMD>
```

Exemple faisant plusiseurs action:

```
CMD> gramma-cli --lemma --morph --suggest --text salut
Morph possible de: salut
 └ >salut/:N:m:s/*
Lemma possible de: salut
 └ salut
Suggestion possible de: salut
98
99
100
101
102
103
104


105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
CMD>
```

## Serveur

Le serveur supporte les requêtes POST et GET...



## Les fichiers

grammalecte/*   : Tout le contennu de Grammalecte pour javascript

api.js          : Un warper pour simplifié l'utilisation de Grammalecte

gramma-cli.bat  : Fait juste un appel «node gramma-cli.js .argument(s)»

gramma-cli.js   : Le code principale pour la console

minimist.js     : Une librairie pour simplifier le parssage des arguments

readme.md       : Le fichier que vous lisez (ou pas) actuellement ;)

script.verf     : Exemple de script pour faire des vérifications automatiques

* (sous widows) type script.verf | gramma-cli -i
* (sous linux) cat script.verf | gramma-cli -i


## Utilisation d'une librairie (incluse)

* [Minimist](https://github.com/substack/minimist) => Simplify parser argument







>
>


















<




106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

133
134
135
136
CMD>
```

## Serveur

Le serveur supporte les requêtes POST et GET...

Par défaut le port d'écoute est le 2212.

## Les fichiers

grammalecte/*   : Tout le contennu de Grammalecte pour javascript

api.js          : Un warper pour simplifié l'utilisation de Grammalecte

gramma-cli.bat  : Fait juste un appel «node gramma-cli.js .argument(s)»

gramma-cli.js   : Le code principale pour la console

minimist.js     : Une librairie pour simplifier le parssage des arguments

readme.md       : Le fichier que vous lisez (ou pas) actuellement ;)

script.verf     : Exemple de script pour faire des vérifications automatiques

* (sous widows) type script.verf | gramma-cli -i
* (sous linux) cat script.verf | gramma-cli -i


## Utilisation d'une librairie (incluse)

* [Minimist](https://github.com/substack/minimist) => Simplify parser argument

Modified gc_lang/fr/nodejs/core/api.js from [c4a1821b48] to [b4423d8bc1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
/*
    ! Grammalecte, grammar checker !
    API pour faciliter l'utilisation de Grammalecte.
*/

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console */

"use strict";

class GrammarChecker {

    constructor(aInit, sPathRoot = "", sLangCode = "fr", sContext = "Javascript") {
        this.sLangCode = sLangCode;
        this.sPathRoot = sPathRoot;
        this.sContext = sContext;

        //Importation des fichiers nécessaire

        this._helpers = require(sPathRoot + "/graphspell/helpers.js");

        this.isInit = {
            Grammalecte: false,
            Graphspell: false,
            Tokenizer: false,
            TextFormatter: false,
            Lexicographer: false













|

<



>
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22
23
24
25
26
27
/*
    ! Grammalecte, grammar checker !
    API pour faciliter l'utilisation de Grammalecte.
*/

/* jshint esversion:6, -W097 */
/* jslint esversion:6 */
/* global require, exports, console */

"use strict";

class GrammarChecker {

    constructor(aInit, sLangCode = "fr", sContext = "Javascript") {
        this.sLangCode = sLangCode;

        this.sContext = sContext;

        //Importation des fichiers nécessaire
        this.sPathRoot = __dirname + "/grammalecte";
        this._helpers = require(this.sPathRoot + "/graphspell/helpers.js");

        this.isInit = {
            Grammalecte: false,
            Graphspell: false,
            Tokenizer: false,
            TextFormatter: false,
            Lexicographer: false