Wednesday, February 15, 2012

[C++] Frequency Analysis (Alphabet)

          Hello, Reader ^^! Back again with source code ^^! This time the source code is Frequency Analysis for Alphabet. The source code written in C++. The source code can count how many N-Graph does a text have. It also the percentage of each N-Graph. Example:

> Input with Digraph (2-Graph):
"One day, I got a chicken lemper. However, when I ate it, it has no chicken meat.Where did the chicken go?"

> Output:

ON => 1 (2.5%)
ED => 1 (2.5%)
AY => 1 (2.5%)
IG => 1 (2.5%)
OT => 1 (2.5%)
AC => 1 (2.5%)
HI => 1 (2.5%)
CK => 1 (2.5%)
EN => 1 (2.5%)
LE => 1 (2.5%)
MP => 1 (2.5%)
ER => 1 (2.5%)
HO => 1 (2.5%)
WE => 1 (2.5%)
VE => 1 (2.5%)
RW => 1 (2.5%)
HE => 3 (7.5%)
NI => 1 (2.5%)
AT => 1 (2.5%)
EI => 1 (2.5%)
TI => 1 (2.5%)
TH => 1 (2.5%)
AS => 1 (2.5%)
NO => 1 (2.5%)
CH => 2 (5%)
IC => 2 (5%)
KE => 2 (5%)
NM => 1 (2.5%)
EA => 1 (2.5%)
TW => 1 (2.5%)
RE => 1 (2.5%)
DI => 1 (2.5%)
DT => 1 (2.5%)
NG => 1 (2.5%)
O? => 1 (2.5%)

As you can see, there is '?' there. That will ensure if there is some letters left which is not multiplied by N, then it will append '?' character. Okay, that's all I can say. Thank you for reading ^^!












2 comments: