moxy-ta
v1.0.2
Published
Moxy - Text analysis tool
Downloads
16
Readme
textAnalysis
Text analysis library for MoxyScript
Use
const MoxyTA = require('moxy-ta')
const ta = new MoxyTA(doc)
const result = ta.scan()
console.log(result)
Example output
console.log tests/moxy-ta.test.ts:13
{ alphabetFrequency:
{ a: 2,
b: 0,
c: 4,
d: 2,
e: 9,
f: 2,
g: 2,
h: 8,
i: 10,
j: 0,
k: 5,
l: 8,
m: 1,
n: 6,
o: 16,
p: 1,
q: 0,
r: 6,
s: 12,
t: 15,
u: 5,
v: 0,
w: 12,
x: 0,
y: 4,
z: 0 },
alphabetFrequencyPercent:
[ { letter: 'a', frequency: 0.015384615384615385 },
{ letter: 'b', frequency: 0 },
{ letter: 'c', frequency: 0.03076923076923077 },
{ letter: 'd', frequency: 0.015384615384615385 },
{ letter: 'e', frequency: 0.06923076923076923 },
{ letter: 'f', frequency: 0.015384615384615385 },
{ letter: 'g', frequency: 0.015384615384615385 },
{ letter: 'h', frequency: 0.06153846153846154 },
{ letter: 'i', frequency: 0.07692307692307693 },
{ letter: 'j', frequency: 0 },
{ letter: 'k', frequency: 0.038461538461538464 },
{ letter: 'l', frequency: 0.06153846153846154 },
{ letter: 'm', frequency: 0.007692307692307693 },
{ letter: 'n', frequency: 0.046153846153846156 },
{ letter: 'o', frequency: 0.12307692307692308 },
{ letter: 'p', frequency: 0.007692307692307693 },
{ letter: 'q', frequency: 0 },
{ letter: 'r', frequency: 0.046153846153846156 },
{ letter: 's', frequency: 0.09230769230769231 },
{ letter: 't', frequency: 0.11538461538461539 },
{ letter: 'u', frequency: 0.038461538461538464 },
{ letter: 'v', frequency: 0 },
{ letter: 'w', frequency: 0.09230769230769231 },
{ letter: 'x', frequency: 0 },
{ letter: 'y', frequency: 0.03076923076923077 },
{ letter: 'z', frequency: 0 } ],
punctuationFrequency:
{ comma: 0,
exclamation: 2,
period: 4,
colon: 1,
semicolon: 0,
questionMark: 4,
singleQuote: 0,
doubleQuote: 0 },
topWords:
[ { word: 'well', frequency: 0.05714285714285714 },
{ word: 'works', frequency: 0.05714285714285714 },
{ word: 'How', frequency: 0.05714285714285714 },
{ word: 'is', frequency: 0.05714285714285714 },
{ word: 'guys', frequency: 0.02857142857142857 },
{ word: 'test', frequency: 0.02857142857142857 },
{ word: 'We', frequency: 0.02857142857142857 },
{ word: 'This', frequency: 0.02857142857142857 },
{ word: 'will', frequency: 0.02857142857142857 },
{ word: 'how', frequency: 0.02857142857142857 },
{ word: 'find', frequency: 0.02857142857142857 },
{ word: 'my', frequency: 0.02857142857142857 },
{ word: 'out', frequency: 0.02857142857142857 },
{ word: 'currently', frequency: 0.02857142857142857 },
{ word: 'soon', frequency: 0.02857142857142857 },
{ word: 'tset', frequency: 0.02857142857142857 },
{ word: 'Woot', frequency: 0.02857142857142857 },
{ word: 'you', frequency: 0.02857142857142857 },
{ word: 'What', frequency: 0.02857142857142857 },
{ word: 'think', frequency: 0.02857142857142857 } ],
totals:
{ letterPercentage: 0.7386363636363636,
punctuationPercentage: 0.0625,
totalLetters: 130,
totalPunctuation: 11,
totalWords: 35,
wordPercentage: 0.19886363636363635 },
wordFrequency:
{ This: { frequency: 1 },
is: { frequency: 2 },
a: { frequency: 1 },
tset: { frequency: 1 },
to: { frequency: 1 },
see: { frequency: 1 },
how: { frequency: 1 },
well: { frequency: 2 },
my: { frequency: 1 },
script: { frequency: 1 },
currently: { frequency: 1 },
works: { frequency: 2 },
How: { frequency: 2 },
do: { frequency: 1 },
you: { frequency: 1 },
think: { frequency: 1 },
it: { frequency: 1 },
We: { frequency: 1 },
will: { frequency: 1 },
find: { frequency: 1 },
out: { frequency: 1 },
soon: { frequency: 1 },
Woot: { frequency: 1 },
What: { frequency: 1 },
the: { frequency: 1 },
buck: { frequency: 1 },
this: { frequency: 1 },
working: { frequency: 1 },
colon: { frequency: 1 },
test: { frequency: 1 } } }