-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTest.js
More file actions
42 lines (42 loc) · 2.42 KB
/
Test.js
File metadata and controls
42 lines (42 loc) · 2.42 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
const { PerformanceObserver, performance } = require('perf_hooks');
const NLP = require('./index')("TextCompletion");
const obs = new PerformanceObserver((items) => {
console.log("Took " + items.getEntries()[0].duration + "ms to run");
performance.clearMarks();
});
obs.observe({ entryTypes: ['measure'] });
performance.mark("TextCorrection-start");
let list = [
'add', 'apakah', 'apa', 'bangroup',
'banuser', 'base64', 'blur', 'brainly',
'brightness', 'broadcastgc', 'bcgc', 'broadcast',
'bc', 'calc', 'hitung', 'changebio',
'gantibio', 'changeprefix', 'gantiprefix', 'changeusername',
'gantiusername', 'coloroverlay', 'contrast', 'dadu',
'debase64', 'dehex', 'delete', 'del',
'demorse', 'demote', 'feedback', 'fitnah',
'fakereply', 'gempadirasakan', 'gempaterkini', 'google',
'grayscale', 'grup', 'group', 'hex',
'hiragana', 'hue', 'kapankah', 'kapan',
'katakana', 'kbbi', 'kick', 'halah',
'hilih', 'huluh', 'heleh', 'holoh',
'listgroup', 'lowercase', 'menu', 'help',
'morse', 'negative', 'ping', 'pokoknya',
'promote', 'qr', 'qrscan', 'scanqr',
'randomanime', 'randomcase', 'reversetext', 'romaji',
'run', 'saturation', 'saus', 'sauce',
'ssweb', 'sticker', 'stiker', 's',
'tebakgambar', 'tebakkata', 'textanalyzer', 'analisateks',
'unbangroup', 'unbanuser', 'unsticker', 'unstiker',
'uns', 'unwarn', 'uppercase', 'whutanime',
'wait', 'wangy', 'wangi', 'warn',
'setwelcome', 'wikipedia', 'wiki'
]
let v = new NLP(list);
let result = v.TextCorrection({Needle: "dadu", Threshold: 0.2, NgramsLength: 1, KeyRange: 1, Autofix: false});
result = v.TextCorrection({Needle: "mwny", Threshold: 0.2, NgramsLength: 1, KeyRange: 1, Autofix: false});
// let v = new NLP(["stats", "menu"], {});
// let result = v.TextCompletion("m");
console.log(result);
performance.mark("TextCorrection-end");
performance.measure("TextCorrection-TotalTime", "TextCorrection-start", "TextCorrection-end");