-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.test.js
executable file
·41 lines (40 loc) · 2.17 KB
/
main.test.js
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
const a = Date.now()
import ts from './main.js';
import fs from 'fs';
const text = fs.readFileSync('sample_text.txt', 'utf8')
console.log('Text: ')
console.log(text)
function test () {
console.log('charCount: \n', ts.charCount(text))
console.log('letterCount: \n', ts.letterCount(text))
console.log('removePunctuation: \n', ts.removePunctuation(text))
console.log('lexiconCount: \n', ts.lexiconCount(text))
// syllableCounter is different so result is different
// I prefer the result of JS library
console.log('syllableCount: \n', ts.syllableCount(text))
console.log('sentenceCount: \n', ts.sentenceCount(text))
console.log('averageSentenceLength: \n', ts.averageSentenceLength(text))
console.log('averageSyllablePerWord: \n', ts.averageSyllablePerWord(text))
console.log('averageCharacterPerWord: \n', ts.averageCharacterPerWord(text))
console.log('averageLetterPerWord: \n', ts.averageLetterPerWord(text))
console.log('averageSentencePerWord: \n', ts.averageSentencePerWord(text))
console.log('fleschReadingEase: \n', ts.fleschReadingEase(text))
console.log('fleschReadingEase grade: \n', ts.fleschReadingEaseToGrade(ts.fleschReadingEase(text)))
console.log('fleschKincaidGrade: \n', ts.fleschKincaidGrade(text))
console.log('polySyllableCount: \n', ts.polySyllableCount(text))
console.log('smogIndex: \n', ts.smogIndex(text))
console.log('colemanLiauIndex: \n', ts.colemanLiauIndex(text))
console.log('automatedReadabilityIndex: \n', ts.automatedReadabilityIndex(text))
console.log('linsearWriteFormula: \n', ts.linsearWriteFormula(text))
console.log('difficultWords: \n', ts.difficultWords(text))
console.log('difficultWordsSet: \n', ts.difficultWordsSet(text))
console.log('daleChallReadabilityScore: \n', ts.daleChallReadabilityScore(text))
console.log('daleChallReadabilityScore grade: \n', ts.daleChallToGrade(ts.daleChallReadabilityScore(text)))
console.log('gunningFog: \n', ts.gunningFog(text))
console.log('lix: \n', ts.lix(text))
console.log('rix: \n', ts.rix(text))
console.log('textStandard: \n', ts.textStandard(text))
console.log('textMedian: \n', ts.textMedian(text))
}
test()
console.log('Time taken for execution : ', Date.now() - a, 'ms')