natural 0.6.0 → 0.6.1
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"classifier":{"classFeatures":{"computing":{"0":2,"1":2,"2":2,"3":3,"4":2,"5":2},"literature":{"2":2,"6":4,"7":2,"8":2}},"classTotals":{"computing":4,"literature":4},"totalExamples":7,"smoothing":1},"docs":[{"label":"computing","text":["fix","box"]},{"label":"computing","text":["write","code"]},{"label":"computing","text":["nasti","script","code"]},{"label":"literature","text":["write","book"]},{"label":"literature","text":["read","book"]},{"label":"literature","text":["studi","book"]}],"features":{"fix":1,"box":1,"write":2,"code":2,"nasti":1,"script":1,"book":3,"read":1,"studi":1},"stemmer":{},"lastAdded":6,"events":{"_events":{},"_eventsCount":0}}
|
package/classifier.json
ADDED
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
{
|
|
2
|
+
"features": {
|
|
3
|
+
"features": [
|
|
4
|
+
{
|
|
5
|
+
"name": "isZero",
|
|
6
|
+
"parameters": [
|
|
7
|
+
"0"
|
|
8
|
+
],
|
|
9
|
+
"parametersKey": "0",
|
|
10
|
+
"observedExpect": 0.3
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "isOne",
|
|
14
|
+
"parameters": [
|
|
15
|
+
"1"
|
|
16
|
+
],
|
|
17
|
+
"parametersKey": "1",
|
|
18
|
+
"observedExpect": 0.3
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "Correction feature",
|
|
22
|
+
"parameters": [],
|
|
23
|
+
"parametersKey": "",
|
|
24
|
+
"observedExpect": 0.4
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"map": {
|
|
28
|
+
"isZero | 0": true,
|
|
29
|
+
"isOne | 1": true,
|
|
30
|
+
"Correction feature | ": true
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"sample": {
|
|
34
|
+
"frequencyOfContext": {
|
|
35
|
+
"\"0\"": 6,
|
|
36
|
+
"\"1\"": 4
|
|
37
|
+
},
|
|
38
|
+
"frequency": {
|
|
39
|
+
"x\"0\"": 3,
|
|
40
|
+
"y\"0\"": 3,
|
|
41
|
+
"x\"1\"": 1,
|
|
42
|
+
"y\"1\"": 3
|
|
43
|
+
},
|
|
44
|
+
"classes": [
|
|
45
|
+
"x",
|
|
46
|
+
"y"
|
|
47
|
+
],
|
|
48
|
+
"elements": [
|
|
49
|
+
{
|
|
50
|
+
"a": "x",
|
|
51
|
+
"b": {
|
|
52
|
+
"data": "0",
|
|
53
|
+
"key": "\"0\""
|
|
54
|
+
},
|
|
55
|
+
"key": "x\"0\""
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"a": "x",
|
|
59
|
+
"b": {
|
|
60
|
+
"data": "0",
|
|
61
|
+
"key": "\"0\""
|
|
62
|
+
},
|
|
63
|
+
"key": "x\"0\""
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"a": "x",
|
|
67
|
+
"b": {
|
|
68
|
+
"data": "0",
|
|
69
|
+
"key": "\"0\""
|
|
70
|
+
},
|
|
71
|
+
"key": "x\"0\""
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"a": "y",
|
|
75
|
+
"b": {
|
|
76
|
+
"data": "0",
|
|
77
|
+
"key": "\"0\""
|
|
78
|
+
},
|
|
79
|
+
"key": "y\"0\""
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"a": "y",
|
|
83
|
+
"b": {
|
|
84
|
+
"data": "0",
|
|
85
|
+
"key": "\"0\""
|
|
86
|
+
},
|
|
87
|
+
"key": "y\"0\""
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"a": "y",
|
|
91
|
+
"b": {
|
|
92
|
+
"data": "0",
|
|
93
|
+
"key": "\"0\""
|
|
94
|
+
},
|
|
95
|
+
"key": "y\"0\""
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"a": "x",
|
|
99
|
+
"b": {
|
|
100
|
+
"data": "1",
|
|
101
|
+
"key": "\"1\""
|
|
102
|
+
},
|
|
103
|
+
"key": "x\"1\""
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"a": "y",
|
|
107
|
+
"b": {
|
|
108
|
+
"data": "1",
|
|
109
|
+
"key": "\"1\""
|
|
110
|
+
},
|
|
111
|
+
"key": "y\"1\""
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"a": "y",
|
|
115
|
+
"b": {
|
|
116
|
+
"data": "1",
|
|
117
|
+
"key": "\"1\""
|
|
118
|
+
},
|
|
119
|
+
"key": "y\"1\""
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"a": "y",
|
|
123
|
+
"b": {
|
|
124
|
+
"data": "1",
|
|
125
|
+
"key": "\"1\""
|
|
126
|
+
},
|
|
127
|
+
"key": "y\"1\""
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
"scaler": {
|
|
132
|
+
"featureSet": {
|
|
133
|
+
"features": [
|
|
134
|
+
{
|
|
135
|
+
"name": "isZero",
|
|
136
|
+
"parameters": [
|
|
137
|
+
"0"
|
|
138
|
+
],
|
|
139
|
+
"parametersKey": "0",
|
|
140
|
+
"observedExpect": 0.3
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "isOne",
|
|
144
|
+
"parameters": [
|
|
145
|
+
"1"
|
|
146
|
+
],
|
|
147
|
+
"parametersKey": "1",
|
|
148
|
+
"observedExpect": 0.3
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "Correction feature",
|
|
152
|
+
"parameters": [],
|
|
153
|
+
"parametersKey": "",
|
|
154
|
+
"observedExpect": 0.4
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"map": {
|
|
158
|
+
"isZero | 0": true,
|
|
159
|
+
"isOne | 1": true,
|
|
160
|
+
"Correction feature | ": true
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"sample": {
|
|
164
|
+
"frequencyOfContext": {
|
|
165
|
+
"\"0\"": 6,
|
|
166
|
+
"\"1\"": 4
|
|
167
|
+
},
|
|
168
|
+
"frequency": {
|
|
169
|
+
"x\"0\"": 3,
|
|
170
|
+
"y\"0\"": 3,
|
|
171
|
+
"x\"1\"": 1,
|
|
172
|
+
"y\"1\"": 3
|
|
173
|
+
},
|
|
174
|
+
"classes": [
|
|
175
|
+
"x",
|
|
176
|
+
"y"
|
|
177
|
+
],
|
|
178
|
+
"elements": [
|
|
179
|
+
{
|
|
180
|
+
"a": "x",
|
|
181
|
+
"b": {
|
|
182
|
+
"data": "0",
|
|
183
|
+
"key": "\"0\""
|
|
184
|
+
},
|
|
185
|
+
"key": "x\"0\""
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"a": "x",
|
|
189
|
+
"b": {
|
|
190
|
+
"data": "0",
|
|
191
|
+
"key": "\"0\""
|
|
192
|
+
},
|
|
193
|
+
"key": "x\"0\""
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"a": "x",
|
|
197
|
+
"b": {
|
|
198
|
+
"data": "0",
|
|
199
|
+
"key": "\"0\""
|
|
200
|
+
},
|
|
201
|
+
"key": "x\"0\""
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"a": "y",
|
|
205
|
+
"b": {
|
|
206
|
+
"data": "0",
|
|
207
|
+
"key": "\"0\""
|
|
208
|
+
},
|
|
209
|
+
"key": "y\"0\""
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"a": "y",
|
|
213
|
+
"b": {
|
|
214
|
+
"data": "0",
|
|
215
|
+
"key": "\"0\""
|
|
216
|
+
},
|
|
217
|
+
"key": "y\"0\""
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"a": "y",
|
|
221
|
+
"b": {
|
|
222
|
+
"data": "0",
|
|
223
|
+
"key": "\"0\""
|
|
224
|
+
},
|
|
225
|
+
"key": "y\"0\""
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"a": "x",
|
|
229
|
+
"b": {
|
|
230
|
+
"data": "1",
|
|
231
|
+
"key": "\"1\""
|
|
232
|
+
},
|
|
233
|
+
"key": "x\"1\""
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"a": "y",
|
|
237
|
+
"b": {
|
|
238
|
+
"data": "1",
|
|
239
|
+
"key": "\"1\""
|
|
240
|
+
},
|
|
241
|
+
"key": "y\"1\""
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"a": "y",
|
|
245
|
+
"b": {
|
|
246
|
+
"data": "1",
|
|
247
|
+
"key": "\"1\""
|
|
248
|
+
},
|
|
249
|
+
"key": "y\"1\""
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"a": "y",
|
|
253
|
+
"b": {
|
|
254
|
+
"data": "1",
|
|
255
|
+
"key": "\"1\""
|
|
256
|
+
},
|
|
257
|
+
"key": "y\"1\""
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
"iteration": 3,
|
|
262
|
+
"improvement": 0.008269762368828815,
|
|
263
|
+
"C": 1,
|
|
264
|
+
"featureSums": {
|
|
265
|
+
"x\"0\"": 1,
|
|
266
|
+
"y\"0\"": 0,
|
|
267
|
+
"x\"1\"": 0,
|
|
268
|
+
"y\"1\"": 1
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"p": {
|
|
272
|
+
"alpha": [
|
|
273
|
+
0.8442857142857142,
|
|
274
|
+
1.8851785714285711,
|
|
275
|
+
0.777505117061545
|
|
276
|
+
],
|
|
277
|
+
"featureSet": {
|
|
278
|
+
"features": [
|
|
279
|
+
{
|
|
280
|
+
"name": "isZero",
|
|
281
|
+
"parameters": [
|
|
282
|
+
"0"
|
|
283
|
+
],
|
|
284
|
+
"parametersKey": "0",
|
|
285
|
+
"observedExpect": 0.3
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"name": "isOne",
|
|
289
|
+
"parameters": [
|
|
290
|
+
"1"
|
|
291
|
+
],
|
|
292
|
+
"parametersKey": "1",
|
|
293
|
+
"observedExpect": 0.3
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"name": "Correction feature",
|
|
297
|
+
"parameters": [],
|
|
298
|
+
"parametersKey": "",
|
|
299
|
+
"observedExpect": 0.4
|
|
300
|
+
}
|
|
301
|
+
],
|
|
302
|
+
"map": {
|
|
303
|
+
"isZero | 0": true,
|
|
304
|
+
"isOne | 1": true,
|
|
305
|
+
"Correction feature | ": true
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
"sample": {
|
|
309
|
+
"frequencyOfContext": {
|
|
310
|
+
"\"0\"": 6,
|
|
311
|
+
"\"1\"": 4
|
|
312
|
+
},
|
|
313
|
+
"frequency": {
|
|
314
|
+
"x\"0\"": 3,
|
|
315
|
+
"y\"0\"": 3,
|
|
316
|
+
"x\"1\"": 1,
|
|
317
|
+
"y\"1\"": 3
|
|
318
|
+
},
|
|
319
|
+
"classes": [
|
|
320
|
+
"x",
|
|
321
|
+
"y"
|
|
322
|
+
],
|
|
323
|
+
"elements": [
|
|
324
|
+
{
|
|
325
|
+
"a": "x",
|
|
326
|
+
"b": {
|
|
327
|
+
"data": "0",
|
|
328
|
+
"key": "\"0\""
|
|
329
|
+
},
|
|
330
|
+
"key": "x\"0\""
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"a": "x",
|
|
334
|
+
"b": {
|
|
335
|
+
"data": "0",
|
|
336
|
+
"key": "\"0\""
|
|
337
|
+
},
|
|
338
|
+
"key": "x\"0\""
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"a": "x",
|
|
342
|
+
"b": {
|
|
343
|
+
"data": "0",
|
|
344
|
+
"key": "\"0\""
|
|
345
|
+
},
|
|
346
|
+
"key": "x\"0\""
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"a": "y",
|
|
350
|
+
"b": {
|
|
351
|
+
"data": "0",
|
|
352
|
+
"key": "\"0\""
|
|
353
|
+
},
|
|
354
|
+
"key": "y\"0\""
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
"a": "y",
|
|
358
|
+
"b": {
|
|
359
|
+
"data": "0",
|
|
360
|
+
"key": "\"0\""
|
|
361
|
+
},
|
|
362
|
+
"key": "y\"0\""
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"a": "y",
|
|
366
|
+
"b": {
|
|
367
|
+
"data": "0",
|
|
368
|
+
"key": "\"0\""
|
|
369
|
+
},
|
|
370
|
+
"key": "y\"0\""
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"a": "x",
|
|
374
|
+
"b": {
|
|
375
|
+
"data": "1",
|
|
376
|
+
"key": "\"1\""
|
|
377
|
+
},
|
|
378
|
+
"key": "x\"1\""
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"a": "y",
|
|
382
|
+
"b": {
|
|
383
|
+
"data": "1",
|
|
384
|
+
"key": "\"1\""
|
|
385
|
+
},
|
|
386
|
+
"key": "y\"1\""
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"a": "y",
|
|
390
|
+
"b": {
|
|
391
|
+
"data": "1",
|
|
392
|
+
"key": "\"1\""
|
|
393
|
+
},
|
|
394
|
+
"key": "y\"1\""
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"a": "y",
|
|
398
|
+
"b": {
|
|
399
|
+
"data": "1",
|
|
400
|
+
"key": "\"1\""
|
|
401
|
+
},
|
|
402
|
+
"key": "y\"1\""
|
|
403
|
+
}
|
|
404
|
+
]
|
|
405
|
+
},
|
|
406
|
+
"aPriorisBeforeNormalisation": {
|
|
407
|
+
"x\"0\"": 0.8442857142857142,
|
|
408
|
+
"y\"0\"": 0.777505117061545,
|
|
409
|
+
"x\"1\"": 0.777505117061545,
|
|
410
|
+
"y\"1\"": 1.8851785714285711
|
|
411
|
+
},
|
|
412
|
+
"aPrioriNormalisationConstant": 11.298413325389037,
|
|
413
|
+
"aPosterioriNormalisationConstants": {
|
|
414
|
+
"\"0\"": 1.6217908313472593,
|
|
415
|
+
"\"1\"": 2.662683688490116
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
@@ -30,7 +30,7 @@ util.inherits(SentenceTokenizer, Tokenizer);
|
|
|
30
30
|
|
|
31
31
|
SentenceTokenizer.prototype.tokenize = function(text) {
|
|
32
32
|
// break string up in to sentences based on punctation and quotation marks
|
|
33
|
-
var tokens = text.match(/([\"\'\‘\“\'\"\[\(\{\⟨][^\.\?\!]+[\.\?\!][\"\'\’\”\'\"\]\)\}\⟩]|[^\.\?\!]+[
|
|
33
|
+
var tokens = text.match(/([\"\'\‘\“\'\"\[\(\{\⟨][^\.\?\!]+[\.\?\!][\"\'\’\”\'\"\]\)\}\⟩]|[^\.\?\!]+[\.\?\!\s]+)\s?/g);
|
|
34
34
|
|
|
35
35
|
// remove unecessary white space
|
|
36
36
|
tokens = tokens.map(Function.prototype.call, String.prototype.trim);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"classifier":{"examples":{"computing":[[1,1,0,0,0,0,0,0,0],[0,0,1,1,0,0,0,0,0],[0,0,0,1,1,1,0,0,0]],"literature":[[0,0,1,0,0,0,1,0,0],[0,0,0,0,0,0,1,1,0],[0,0,0,0,0,0,1,0,1]]},"features":[],"featurePositions":{},"maxFeaturePosition":0,"classifications":["computing","literature"],"exampleCount":6,"theta":[{"elements":[2.0057203693422903,2.0057203693422903,0.0904766662626176,3.447364098636818,0.9696521506748157,0.9696521506748157,-4.840706080886848,-1.2267353995937322,-1.2267353995937322]},{"elements":[-2.0057203693422894,-2.0057203693422894,-0.09047666626261801,-3.4473640986368186,-0.9696521506748156,-0.9696521506748156,4.84070608088685,1.2267353995937313,1.2267353995937313]}]},"docs":[{"label":"computing","text":["fix","box"]},{"label":"computing","text":["write","code"]},{"label":"computing","text":["nasti","script","code"]},{"label":"literature","text":["write","book"]},{"label":"literature","text":["read","book"]},{"label":"literature","text":["studi","book"]}],"features":{"fix":1,"box":1,"write":2,"code":2,"nasti":1,"script":1,"book":3,"read":1,"studi":1},"stemmer":{},"lastAdded":6,"events":{"_events":{},"_eventsCount":0}}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "natural",
|
|
3
3
|
"description": "General natural language (tokenizing, stemming (English, Russian, Spanish), part-of-speech tagging, sentiment analysis, classification, inflection, phonetics, tfidf, WordNet, jaro-winkler, Levenshtein distance, Dice's Coefficient) facilities for node.",
|
|
4
|
-
"version": "0.6.
|
|
4
|
+
"version": "0.6.1",
|
|
5
5
|
"homepage": "https://github.com/NaturalNode/natural",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"afinn-165": "^1.0.2",
|
|
15
|
-
"apparatus": "^0.0.
|
|
15
|
+
"apparatus": "^0.0.10",
|
|
16
16
|
"json-stable-stringify": "^1.0.1",
|
|
17
17
|
"sylvester": "^0.0.12",
|
|
18
18
|
"underscore": "^1.3.1"
|