ai-nevermore 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -19
- package/bin/nevermore +44 -19
- package/custom-dict.json +224 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -25,37 +25,40 @@ const { html, css } = await generateHTMLAndCSS(root, index);
|
|
|
25
25
|
Command Line Usage
|
|
26
26
|
------------------
|
|
27
27
|
Install with `npm install -g ai-nevermore`
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
```
|
|
29
|
+
nevermore [command]
|
|
30
30
|
|
|
31
31
|
Commands:
|
|
32
|
-
|
|
32
|
+
nevermore pseudotext [input-file] process the input
|
|
33
33
|
|
|
34
34
|
Options:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
--version Show version number [boolean]
|
|
36
|
+
-U, --unified-output File to generate html + css into [string]
|
|
37
|
+
-C, --css-output File to generate css into [string]
|
|
38
|
+
-H, --html-output File to generate html into [string]
|
|
39
|
+
-r, --raw-output Do not wrap the ouput [boolean]
|
|
40
|
+
-s, --size The size of the font in pixels [number] [default: 12]
|
|
41
|
+
-f, --font The font in question (only webfonts are supported)
|
|
42
|
+
[string] [choices: "Andale Mono", "Arial", "Avenir", "Avenir Next", "Comic
|
|
43
|
+
Sans MS", "Courier New", "Georgia", "Helvetica", "Impact", "Inter", "Times New
|
|
44
|
+
Roman", "Trebuchet MS", "Verdana", "Webdings", "Open Sans", "Tahoma"]
|
|
45
|
+
[default: "Arial"]
|
|
46
|
+
--help Show help [boolean]
|
|
47
|
+
```
|
|
45
48
|
|
|
46
49
|
Roadmap
|
|
47
50
|
-------
|
|
48
51
|
|
|
49
|
-
- [
|
|
50
|
-
- [
|
|
51
|
-
- [
|
|
52
|
-
- [ ]
|
|
52
|
+
- [x] raw output mode
|
|
53
|
+
- [x] stdin, stdout support
|
|
54
|
+
- [x] custom dictionary
|
|
55
|
+
- [ ] self randomizing dictionary
|
|
53
56
|
|
|
54
57
|
Development
|
|
55
58
|
-----------
|
|
56
|
-
This release is currently unlicensed and should be treated as proprietary, but open meaning I am not currently accepting collaboration while I move toward 1.0
|
|
59
|
+
This release is currently unlicensed and should be treated as proprietary, but open meaning I am not currently accepting collaboration while I move toward 1.0 nor is this version of the code available for redistribution. I am currently evaluating source licenses for a future release during beta.
|
|
57
60
|
|
|
58
|
-
I am also looking for a robot license, should such a thing exist or
|
|
61
|
+
I am also looking for a robot license, should such a thing exist or some generous legal professional want to help in the creation of one.
|
|
59
62
|
|
|
60
63
|
Enjoy,
|
|
61
64
|
- Abbey Hawk Sparrow
|
package/bin/nevermore
CHANGED
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
import yargs from 'yargs';
|
|
3
3
|
import { hideBin } from 'yargs/helpers';
|
|
4
4
|
import { computeIndexKeys, generateHTMLAndCSS } from '../src/index.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
const { cwd } = process;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const formatHTML = (html, css, isRaw=false)=>{
|
|
11
|
+
if(isRaw) return `${css?`<style>${css}</style>`:''}${html}`;
|
|
12
|
+
return `<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >${css?`<style>${css}</style>`:''}</head><body>${html}</body></html>`;
|
|
13
|
+
};
|
|
6
14
|
|
|
7
15
|
yargs(hideBin(process.argv))
|
|
8
16
|
.command('pseudotext [input-file]', 'process the input', (yargs) => {
|
|
@@ -14,33 +22,46 @@ yargs(hideBin(process.argv))
|
|
|
14
22
|
//console.log(argv)
|
|
15
23
|
let input = '';
|
|
16
24
|
if(!argv['input-file']){
|
|
17
|
-
|
|
25
|
+
input = await new Promise((resolve, reject)=>{
|
|
26
|
+
let data = '';
|
|
27
|
+
process.stdin.on("data", (chunk) => {
|
|
28
|
+
data += chunk.toString();
|
|
29
|
+
});
|
|
30
|
+
process.stdin.on("end", () => {
|
|
31
|
+
resolve(data);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
18
34
|
}else{
|
|
19
|
-
const inputLocation =
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
input = demoFile.body().cast('string'); //.replace(/\n/g, '<br/>');
|
|
35
|
+
const inputLocation = join(cwd(), argv['input-file']);
|
|
36
|
+
const body = await readFile(inputLocation);
|
|
37
|
+
input = body.toString();
|
|
23
38
|
}
|
|
24
39
|
//TODO: custom index
|
|
25
40
|
//TODO: self index
|
|
26
41
|
const { index, root } = await computeIndexKeys(input);
|
|
27
|
-
|
|
42
|
+
let idx = index;
|
|
43
|
+
if(argv['custom-dictionary']){
|
|
44
|
+
const result = await readFile(argv['custom-dictionary']);
|
|
45
|
+
idx = result.toString();
|
|
46
|
+
}
|
|
47
|
+
//const { index, root } = await computeIndexKeys(input);
|
|
48
|
+
console.log(idx);
|
|
49
|
+
process.exit();
|
|
50
|
+
const { html, css } = await generateHTMLAndCSS(root, idx);
|
|
28
51
|
if(argv['unified-output']){
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
await outputFile.save();
|
|
52
|
+
const output = formatHTML(html, css, argv['raw-output']);
|
|
53
|
+
await writeFile(argv['unified-output'], output);
|
|
32
54
|
}else{
|
|
33
55
|
if(argv['css-output'] && argv['html-output']){
|
|
34
|
-
const cssLocation =
|
|
35
|
-
const htmlLocation =
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
await
|
|
39
|
-
const outputStyle = new File(cssLocation);
|
|
40
|
-
outputStyle.body(css);
|
|
41
|
-
await outputStyle.save();
|
|
42
|
-
}else{
|
|
56
|
+
const cssLocation = join(cwd(), argv['css-output']);
|
|
57
|
+
const htmlLocation = join(cwd(), argv['html-output']);
|
|
58
|
+
const output = formatHTML(html, null, argv['raw-output']);
|
|
59
|
+
await writeFile(htmlLocation, output);
|
|
60
|
+
await writeFile(cssLocation, css);
|
|
43
61
|
|
|
62
|
+
}else{
|
|
63
|
+
const output = formatHTML(html, css, argv['raw-output']);
|
|
64
|
+
process.stdout.write(output);
|
|
44
65
|
}
|
|
45
66
|
}
|
|
46
67
|
}).option('unified-output', {
|
|
@@ -64,6 +85,10 @@ yargs(hideBin(process.argv))
|
|
|
64
85
|
type: 'number',
|
|
65
86
|
default: 12,
|
|
66
87
|
description: 'The size of the font in pixels'
|
|
88
|
+
}).option('custom-dictionary', {
|
|
89
|
+
alias: 'd',
|
|
90
|
+
type: 'string',
|
|
91
|
+
description: 'A json map of replacement words'
|
|
67
92
|
}).option('font', {
|
|
68
93
|
alias: 'f',
|
|
69
94
|
type: 'string',
|
package/custom-dict.json
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
{
|
|
2
|
+
"a": "superfluously",
|
|
3
|
+
"midnight": "barbarossa",
|
|
4
|
+
"while": "malefic",
|
|
5
|
+
"i": "rhodium",
|
|
6
|
+
"weary": "willowware",
|
|
7
|
+
"over": "deathbed",
|
|
8
|
+
"volume": "mannerism",
|
|
9
|
+
"lore": "tragicomical",
|
|
10
|
+
"there": "sylvanus",
|
|
11
|
+
"tapping": "harvard",
|
|
12
|
+
"as": "connectivity",
|
|
13
|
+
"one": "incrust",
|
|
14
|
+
"at": "throstle",
|
|
15
|
+
"chamber": "armeria",
|
|
16
|
+
"door": "up-to-date",
|
|
17
|
+
"visitor": "adjectivally",
|
|
18
|
+
"nothing": "ceratonia",
|
|
19
|
+
"more": "assessor",
|
|
20
|
+
"remember": "sls",
|
|
21
|
+
"it": "convallaria",
|
|
22
|
+
"in": "joss",
|
|
23
|
+
"december": "ablate",
|
|
24
|
+
"separate": "hotcake",
|
|
25
|
+
"dying": "sternutative",
|
|
26
|
+
"ember": "allargando",
|
|
27
|
+
"ghost": "underwrite",
|
|
28
|
+
"floor": "mucor",
|
|
29
|
+
"morrow": "pugnacity",
|
|
30
|
+
"borrow": "litigator",
|
|
31
|
+
"surcease": "redirect",
|
|
32
|
+
"sorrow": "primogenitor",
|
|
33
|
+
"lost": "watchful",
|
|
34
|
+
"maiden": "irula",
|
|
35
|
+
"name": "coptis",
|
|
36
|
+
"here": "selenicereus",
|
|
37
|
+
"rustling": "maroc",
|
|
38
|
+
"purple": "esidrix",
|
|
39
|
+
"curtain": "cordaites",
|
|
40
|
+
"me": "chaenactis",
|
|
41
|
+
"felt": "jauntily",
|
|
42
|
+
"so": "flavoring",
|
|
43
|
+
"now": "calgary",
|
|
44
|
+
"still": "uniqueness",
|
|
45
|
+
"beating": "foreshank",
|
|
46
|
+
"heart": "encyclopedia",
|
|
47
|
+
"repeating": "tutelage",
|
|
48
|
+
"entrance": "tetrapod",
|
|
49
|
+
"soul": "slantways",
|
|
50
|
+
"then": "despotic",
|
|
51
|
+
"no": "timorously",
|
|
52
|
+
"longer": "mind-set",
|
|
53
|
+
"sir": "spilogale",
|
|
54
|
+
"or": "elettaria",
|
|
55
|
+
"madam": "cloister",
|
|
56
|
+
"forgiveness": "penciled",
|
|
57
|
+
"implore": "doctorow",
|
|
58
|
+
"fact": "berberidaceae",
|
|
59
|
+
"darkness": "chacma",
|
|
60
|
+
"deep": "trespassing",
|
|
61
|
+
"long": "kadai",
|
|
62
|
+
"dreaming": "warmed",
|
|
63
|
+
"mortal": "paunchy",
|
|
64
|
+
"dream": "liberalisation",
|
|
65
|
+
"silence": "nonwoody",
|
|
66
|
+
"stillness": "impolite",
|
|
67
|
+
"token": "galvaniser",
|
|
68
|
+
"word": "turpitude",
|
|
69
|
+
"an": "reprint",
|
|
70
|
+
"echo": "inflexibility",
|
|
71
|
+
"back": "historian",
|
|
72
|
+
"turning": "labiodental",
|
|
73
|
+
"burning": "fay",
|
|
74
|
+
"window": "growling",
|
|
75
|
+
"lattice": "vasopressin",
|
|
76
|
+
"let": "unconquerable",
|
|
77
|
+
"see": "bastardise",
|
|
78
|
+
"mystery": "underactive",
|
|
79
|
+
"explore": "liquidambar",
|
|
80
|
+
"be": "tracheophyta",
|
|
81
|
+
"moment": "clayey",
|
|
82
|
+
"wind": "streptolysin",
|
|
83
|
+
"open": "sardinian",
|
|
84
|
+
"shutter": "keynes",
|
|
85
|
+
"flirt": "out-of-doors",
|
|
86
|
+
"flutter": "palaeoanthropology",
|
|
87
|
+
"raven": "terefah",
|
|
88
|
+
"days": "menses",
|
|
89
|
+
"yore": "deduce",
|
|
90
|
+
"least": "codling",
|
|
91
|
+
"obeisance": "re-address",
|
|
92
|
+
"he": "lanternfish",
|
|
93
|
+
"minute": "ashy",
|
|
94
|
+
"mien": "unbuttoned",
|
|
95
|
+
"lord": "antifreeze",
|
|
96
|
+
"lady": "self-indulgence",
|
|
97
|
+
"above": "knox",
|
|
98
|
+
"bust": "arborolatry",
|
|
99
|
+
"pallas": "beech",
|
|
100
|
+
"sat": "eradication",
|
|
101
|
+
"ebony": "affricative",
|
|
102
|
+
"bird": "nga",
|
|
103
|
+
"fancy": "roofed",
|
|
104
|
+
"smiling": "scaramouche",
|
|
105
|
+
"grave": "brunei",
|
|
106
|
+
"stern": "balmy",
|
|
107
|
+
"decorum": "ceratostomataceae",
|
|
108
|
+
"countenance": "silvervine",
|
|
109
|
+
"crest": "technologist",
|
|
110
|
+
"thou": "boulder",
|
|
111
|
+
"art": "shiv",
|
|
112
|
+
"craven": "fat",
|
|
113
|
+
"ancient": "stomachic",
|
|
114
|
+
"wandering": "heartfelt",
|
|
115
|
+
"shore": "clapping",
|
|
116
|
+
"tell": "cuckoldry",
|
|
117
|
+
"night": "undset",
|
|
118
|
+
"s": "dullard",
|
|
119
|
+
"much": "fovea",
|
|
120
|
+
"fowl": "pupil",
|
|
121
|
+
"hear": "flashpoint",
|
|
122
|
+
"discourse": "actuarial",
|
|
123
|
+
"answer": "monogynist",
|
|
124
|
+
"little": "thought-provoking",
|
|
125
|
+
"meaning": "yon",
|
|
126
|
+
"relevancy": "panama",
|
|
127
|
+
"bore": "dustcloth",
|
|
128
|
+
"help": "curtness",
|
|
129
|
+
"living": "paramecium",
|
|
130
|
+
"human": "mishegaas",
|
|
131
|
+
"being": "sorely",
|
|
132
|
+
"seeing": "m-1",
|
|
133
|
+
"beast": "kayak",
|
|
134
|
+
"sitting": "technophobic",
|
|
135
|
+
"spoke": "bobwhite",
|
|
136
|
+
"feather": "watertown",
|
|
137
|
+
"till": "reflect",
|
|
138
|
+
"have": "ribonuclease",
|
|
139
|
+
"will": "autotrophic",
|
|
140
|
+
"leave": "suggester",
|
|
141
|
+
"reply": "dilutant",
|
|
142
|
+
"stock": "whatchamacallum",
|
|
143
|
+
"store": "crepitation",
|
|
144
|
+
"master": "steuben",
|
|
145
|
+
"disaster": "pleopod",
|
|
146
|
+
"fast": "impermeable",
|
|
147
|
+
"burden": "unspotted",
|
|
148
|
+
"hope": "low-priced",
|
|
149
|
+
"melancholy": "untruth",
|
|
150
|
+
"straight": "washout",
|
|
151
|
+
"seat": "tenability",
|
|
152
|
+
"front": "portwatcher",
|
|
153
|
+
"velvet": "pyrographic",
|
|
154
|
+
"sinking": "optic",
|
|
155
|
+
"thinking": "reorganisation",
|
|
156
|
+
"croaking": "solderer",
|
|
157
|
+
"guessing": "nakedwood",
|
|
158
|
+
"syllable": "bend",
|
|
159
|
+
"eyes": "plucky",
|
|
160
|
+
"bosom": "sabicu",
|
|
161
|
+
"core": "radiograph",
|
|
162
|
+
"head": "ampere-second",
|
|
163
|
+
"ease": "unliterary",
|
|
164
|
+
"reclining": "full-blood",
|
|
165
|
+
"cushion": "azotaemia",
|
|
166
|
+
"lining": "ringed",
|
|
167
|
+
"lamp": "solidago",
|
|
168
|
+
"light": "lycoperdaceae",
|
|
169
|
+
"o": "invoke",
|
|
170
|
+
"er": "scoreless",
|
|
171
|
+
"violet": "catalyst",
|
|
172
|
+
"gloating": "hypnoid",
|
|
173
|
+
"press": "baseborn",
|
|
174
|
+
"air": "mina",
|
|
175
|
+
"unseen": "squinter",
|
|
176
|
+
"censer": "guru",
|
|
177
|
+
"foot": "account",
|
|
178
|
+
"falls": "intrusive",
|
|
179
|
+
"wretch": "leoncita",
|
|
180
|
+
"god": "kentuckian",
|
|
181
|
+
"lent": "rhabdomyosarcoma",
|
|
182
|
+
"sent": "bihari",
|
|
183
|
+
"respite": "alliterate",
|
|
184
|
+
"quaff": "taiwanese",
|
|
185
|
+
"oh": "scholar",
|
|
186
|
+
"kind": "slavery",
|
|
187
|
+
"forget": "gaggle",
|
|
188
|
+
"prophet": "ex-directory",
|
|
189
|
+
"thing": "automatonlike",
|
|
190
|
+
"evil": "devolvement",
|
|
191
|
+
"devil": "grouseberry",
|
|
192
|
+
"tempter": "ravaged",
|
|
193
|
+
"tempest": "friend",
|
|
194
|
+
"desolate": "windless",
|
|
195
|
+
"desert": "tantalise",
|
|
196
|
+
"land": "holographical",
|
|
197
|
+
"home": "undernourishment",
|
|
198
|
+
"horror": "cobra",
|
|
199
|
+
"balm": "cercarial",
|
|
200
|
+
"heaven": "hydnum",
|
|
201
|
+
"bends": "patronizingly",
|
|
202
|
+
"us": "application",
|
|
203
|
+
"adore": "autoloader",
|
|
204
|
+
"laden": "wintun",
|
|
205
|
+
"clasp": "reredos",
|
|
206
|
+
"sign": "esterify",
|
|
207
|
+
"parting": "sulphate",
|
|
208
|
+
"fiend": "buckwheat",
|
|
209
|
+
"get": "dimensional",
|
|
210
|
+
"black": "interpenetration",
|
|
211
|
+
"plume": "unpaved",
|
|
212
|
+
"lie": "arouser",
|
|
213
|
+
"loneliness": "flagging",
|
|
214
|
+
"quit": "caul",
|
|
215
|
+
"take": "pastrami",
|
|
216
|
+
"beak": "resource",
|
|
217
|
+
"out": "self-supporting",
|
|
218
|
+
"form": "crustose",
|
|
219
|
+
"off": "refueling",
|
|
220
|
+
"demon": "tigerish",
|
|
221
|
+
"streaming": "expiable",
|
|
222
|
+
"shadow": "palaeozoology",
|
|
223
|
+
"floating": "supper"
|
|
224
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-nevermore",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"adversarial",
|
|
6
6
|
"content",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"scripts":{
|
|
32
32
|
"single-file-demo": "./bin/nevermore pseudotext -U output.html nevermore.txt",
|
|
33
|
+
"pipe-demo": "cat nevermore.txt | ./bin/nevermore pseudotext",
|
|
33
34
|
"demo": "./bin/nevermore pseudotext -H out.html -C out.css nevermore.txt"
|
|
34
35
|
},
|
|
35
36
|
"dependencies": {
|