let size t = tree_size t.doc;;
let magic_string = "SXSI_INDEX"
-let version_string = "3"
+let version_string = "4"
let pos fd =
Unix.lseek fd 0 Unix.SEEK_CUR
let _ = set_binary_mode_in in_c true in
let load_table () =
(let ms = input_line in_c in if ms <> magic_string then failwith "Invalid index file");
- (let vs = input_line in_c in if vs <> version_string then failwith "Invalid version file");
+ (let vs = input_line in_c in if vs <> version_string then failwith "Unsupported index format");
let c = load_tag_table in_c in
let s = load_tag_table in_c in
let d = load_tag_table in_c in
in
traverse tree.doc root [] 0;
let sumdepth = Hashtbl.fold (fun p c acc -> (List.length p) * c + acc) h 0 in
-
+ let alltags = Ptset.Int.union tree.elements tree.attributes in
Logger.print err_formatter "Statistics :@\n\
Average depth: %f@\n\
Longest path: %i@\n\
Number of nodes: %i@\n\
Number of leaves: %i@\n\
Number of pcdata/cdata nodes: %i@\n\
-Number of distinct tags: %i@\n@?"
+Number of distinct tags: %i@\n\
+Largest tag id: %i@\n@?"
(float_of_int sumdepth /. float_of_int !numleaves)
!depth
(Hashtbl.length h)
(tree_subtree_size tree.doc root)
!numleaves
!numtexts
- (Ptset.Int.cardinal (Ptset.Int.union tree.elements tree.attributes))
+ (Ptset.Int.cardinal alltags)
+ (Ptset.Int.max_elt alltags)
(*
Logger.print err_formatter "Average depth: %f, number of leaves %i@\n@?" ((float_of_int a)/. (float_of_int b)) b