Function build_table_by_sampling

Source
pub fn build_table_by_sampling(strings: &Vec<String>) -> Box<dyn SymbolTable>
Expand description

build symbol table by sampling the given strings symbol table can be used to build Encoder and Decoder

ยงExample

use fsst_rust::build_table_by_sampling;
use fsst_rust::core::codec::{Decoder, Encoder};
let strings = vec!["abcd".to_string(), "efgh".to_string()];
let symbol_table = build_table_by_sampling(&strings);
let encoder = Encoder::from_table(&symbol_table);
let str = "abc";
let encoding = encoder.encode(&str, false);
let decoder = Decoder::from_table(&symbol_table);
let decode_str = decoder.decode(&encoding);
assert_eq!(str, decode_str);