the interface for text character analysis.
https://github.com/YujiSODE/txtStat
Copyright (c) 2017 Yuji SODE <yuji.sode@gmail.com>
This software is released under the MIT License.
See LICENSE or http://opensource.org/licenses/mit-license.php
FunctiontxtStat(FLG95)
loads text data and make a graph of frequency against the Unicode codepoints,
and returns function that returns character analysis result.
txtStat.js
- To activate interface:
var y=txtStat();
- To get character analysis result:
y();
An object is returned as a result.
-
Textarea: a text input for analysis.
-
Color input: a color for a graph.
-
Load button; it loads text data in "Textarea" as a set of data.
-
Analyze button; it analyzes all loaded text datasets and make a graph of frequency against the Unicode
codepoints on canvas tag. Optionally another canvas tag is also available to output. -
Clear textarea button; it clears only "Textarea".
-
Reset loaded data button; it clears only loaded text datasets.
-
Close button; it closes this interface.
This is an object returned by a function, which is returned by functiontxtStat(FLG95)
.
This object has 9 values
-
data
: JSON formatted loaded data with a valueN
indicating a cumulative frequency of text datasets. -
results
: a result of analysis.
This is an object with 4 valuesxMax
: the max Unicode codepoint value in datasets.xMin
: the min Unicode codepoint value in datasets.maxFreq
: the max frequency.range
: range of datasets.
-
color
: color of graph. -
log
: a timestamp. -
xMax
: the max Unicode codepoint value in loaded text datasets.
This is an object with 4 values(x
,x16
,char
, andxMaxFreq
; see 6.xMin
). -
xMin
: the min Unicode codepoint value in loaded text datasets.
xMax
andxMin
are objects with 4 values.x
: the Unicode codepoint value.x16
: the Unicode codepoint value in hexadecimal.char
: a character at the Unicode codepoint value.xMaxFreq
|xMinFreq
: character frequency.
-
dx
: true scale of x-axis.
Another width-extended canvas tag is recommended whendx << 1
. -
dy
: true scale of y-axis. -
lineWidth
: width of bar chart.
-
Setting of function
txtStat(FLG95)
FLG95
:true
|false
; 95% of canvas width is shown whenFLG95 = true
. -
Setting of another canvas tag to output
A valid id of another canvas tag can be input when Analyze button is clicked.
Character analysis result is overwritten by result of another canvas tag when input id is valid. -
Setting of canvas width
Width of another canvas tag can be changed when input id is valid.