Re: 世界大百科事典
■予想
(1) フラグなし LZSS + 適応型ハフマン
(2) 一致長と不一致文字をひとつのハフマン木にすることにより、フラグをなくす
(4) FGK法でハフマン木の更新
(5) 一致開始位置は11ビット固定
(6) 文字の葉が 256枚、一致文字数の葉が 58枚
(7) 一致文字数は 3 から 60
■初期ハフマン木の作り方
1) 256枚の文字の葉の後ろに58枚の一致文字数の葉を繋げる
2) 先頭の2ノードを合体し、最後尾に繋げる
3) 2 へ
> > (4) FGK法でハフマン木の更新
>
> これは何かそう見える断片があるということですか?
それは、
> 18文字ではなく60文字のコピーになってしまいました。
これが決定的です。
まず``18文字コピー''が出現したのでこの頻度が 1 増えます。
FGK では 1 増やす前に、現在のその頻度と同じ頻度のうち、
最も後ろのものとスワップします。
■初期ハフマン木
00000000 char t
00000001 char u
00000010 char v
00000011 char w
00000100 char x
00000101 char y
00000110 char z
00000111 char {
00001000 char |
00001001 char }
00001010 char ~
00001011 char \127
00001100 char \128
00001101 char \129
00001110 char \130
00001111 char \131
00010000 char \132
00010001 char \133
00010010 char \134
00010011 char \135
00010100 char \136
00010101 char \137
00010110 char \138
00010111 char \139
00011000 char \140
00011001 char \141
00011010 char \142
00011011 char \143
00011100 char \144
00011101 char \145
00011110 char \146
00011111 char \147
00100000 char \148
00100001 char \149
00100010 char \150
00100011 char \151
00100100 char \152
00100101 char \153
00100110 char \154
00100111 char \155
00101000 char \156
00101001 char \157
00101010 char \158
00101011 char \159
00101100 char \160
00101101 char \161
00101110 char \162
00101111 char \163
00110000 char \164
00110001 char \165
00110010 char \166
00110011 char \167
00110100 char \168
00110101 char \169
00110110 char \170
00110111 char \171
00111000 char \172
00111001 char \173
00111010 char \174
00111011 char \175
00111100 char \176
00111101 char \177
00111110 char \178
00111111 char \179
01000000 char \180
01000001 char \181
01000010 char \182
01000011 char \183
01000100 char \184
01000101 char \185
01000110 char \186
01000111 char \187
01001000 char \188
01001001 char \189
01001010 char \190
01001011 char \191
01001100 char \192
01001101 char \193
01001110 char \194
01001111 char \195
01010000 char \196
01010001 char \197
01010010 char \198
01010011 char \199
01010100 char \200
01010101 char \201
01010110 char \202
01010111 char \203
01011000 char \204
01011001 char \205
01011010 char \206
01011011 char \207
01011100 char \208
01011101 char \209
01011110 char \210
01011111 char \211
01100000 char \212
01100001 char \213
01100010 char \214
01100011 char \215
01100100 char \216
01100101 char \217
01100110 char \218
01100111 char \219
01101000 char \220
01101001 char \221
01101010 char \222
01101011 char \223
01101100 char \224
01101101 char \225
01101110 char \226
01101111 char \227
01110000 char \228
01110001 char \229
01110010 char \230
01110011 char \231
01110100 char \232
01110101 char \233
01110110 char \234
01110111 char \235
01111000 char \236
01111001 char \237
01111010 char \238
01111011 char \239
01111100 char \240
01111101 char \241
01111110 char \242
01111111 char \243
10000000 char \244
10000001 char \245
10000010 char \246
10000011 char \247
10000100 char \248
10000101 char \249
10000110 char \250
10000111 char \251
10001000 char \252
10001001 char \253
10001010 char \254
10001011 char \255
10001100 copy 3
10001101 copy 4
10001110 copy 5
10001111 copy 6
10010000 copy 7
10010001 copy 8
10010010 copy 9
10010011 copy 10
10010100 copy 11
10010101 copy 12
10010110 copy 13
10010111 copy 14
10011000 copy 15
10011001 copy 16
10011010 copy 17
10011011 copy 18
10011100 copy 19
10011101 copy 20
10011110 copy 21
10011111 copy 22
10100000 copy 23
10100001 copy 24
10100010 copy 25
10100011 copy 26
10100100 copy 27
10100101 copy 28
10100110 copy 29
10100111 copy 30
10101000 copy 31
10101001 copy 32
10101010 copy 33
10101011 copy 34
10101100 copy 35
10101101 copy 36
10101110 copy 37
10101111 copy 38
10110000 copy 39
10110001 copy 40
10110010 copy 41
10110011 copy 42
10110100 copy 43
10110101 copy 44
10110110 copy 45
10110111 copy 46
10111000 copy 47
10111001 copy 48
10111010 copy 49
10111011 copy 50
10111100 copy 51
10111101 copy 52
10111110 copy 53
10111111 copy 54
11000000 copy 55
11000001 copy 56
11000010 copy 57
11000011 copy 58
11000100 copy 59
11000101 copy 60
110001100 char \000
110001101 char \001
110001110 char \002
110001111 char \003
110010000 char \004
110010001 char \005
110010010 char \006
110010011 char \007
110010100 char \008
110010101 char \t
110010110 char \n
110010111 char \011
110011000 char \012
110011001 char \013
110011010 char \014
110011011 char \015
110011100 char \016
110011101 char \017
110011110 char \018
110011111 char \019
110100000 char \020
110100001 char \021
110100010 char \022
110100011 char \023
110100100 char \024
110100101 char \025
110100110 char \026
110100111 char \027
110101000 char \028
110101001 char \029
110101010 char \030
110101011 char \031
110101100 char
110101101 char !
110101110 char "
110101111 char #
110110000 char $
110110001 char %
110110010 char &
110110011 char \'
110110100 char (
110110101 char )
110110110 char *
110110111 char +
110111000 char ,
110111001 char -
110111010 char .
110111011 char /
110111100 char 0
110111101 char 1
110111110 char 2
110111111 char 3
111000000 char 4
111000001 char 5
111000010 char 6
111000011 char 7
111000100 char 8
111000101 char 9
111000110 char :
111000111 char ;
111001000 char <
111001001 char =
111001010 char >
111001011 char ?
111001100 char @
111001101 char A
111001110 char B
111001111 char C
111010000 char D
111010001 char E
111010010 char F
111010011 char G
111010100 char H
111010101 char I
111010110 char J
111010111 char K
111011000 char L
111011001 char M
111011010 char N
111011011 char O
111011100 char P
111011101 char Q
111011110 char R
111011111 char S
111100000 char T
111100001 char U
111100010 char V
111100011 char W
111100100 char X
111100101 char Y
111100110 char Z
111100111 char [
111101000 char \\
111101001 char ]
111101010 char ^
111101011 char _
111101100 char `
111101101 char a
111101110 char b
111101111 char c
111110000 char d
111110001 char e
111110010 char f
111110011 char g
111110100 char h
111110101 char i
111110110 char j
111110111 char k
111111000 char l
111111001 char m
111111010 char n
111111011 char o
111111100 char p
111111101 char q
111111110 char r
111111111 char s
===File ~/tmp/tree.ml=======================================
let rec make_list n =
let i = ref (n-1) in
let list = ref [] in
while !i >= 0 do
list := !i :: !list;
decr i
done;
!list
type node =
CopyLeaf of int
| CharLeaf of char
| Node of node * node
let chars = List.map (fun x -> CharLeaf (Char.chr x)) (make_list 256)
let copys = List.map (fun x -> CopyLeaf (x + 3)) (make_list 58)
let init = chars @ copys
let rec make_tree = function
[] -> failwith ""
| hd::[] -> hd
| h1::h2::rest -> make_tree (rest@[Node (h1,h2)])
let tree = make_tree init
let rec print_tree tree str =
match tree with
Node (left, right) ->
print_tree left (str ^ "0");
print_tree right (str ^ "1")
| CopyLeaf l ->
Printf.printf "%s copy %d\n" str l
| CharLeaf c ->
Printf.printf "%s char %s\n" str (Char.escaped c)
let test c =
let copys = List.map (fun x -> CopyLeaf x) (make_list c) in
let init = chars @ copys in
print_tree (make_tree init) ""
let test2 () = print_tree tree ""
let _ = test2 ()
============================================================
今はFGK法を実装している時間がないので、これでお終い。
Fnews-brouse 1.9(20180406) -- by Mizuno, MWE <mwe@ccsf.jp>
GnuPG Key ID = ECC8A735
GnuPG Key fingerprint = 9BE6 B9E9 55A5 A499 CD51 946E 9BDC 7870 ECC8 A735