Пример #1
0
func loadMinhashFormatV1(r io.Reader) (*Minhash, error) {
	data, err := bit.LoadArray(r)
	if err != nil {
		return nil, err
	}
	return &Minhash{data}, nil
}
Пример #2
0
func loadLSHFormatV1(r io.Reader) (*LSH, error) {
	data, err := bit.LoadArray(r)
	if err != nil {
		return nil, err
	}
	return &LSH{data}, nil
}
Пример #3
0
func loadEuclidLSHFormatV1(r io.Reader) (*EuclidLSH, error) {
	var d euclidLSHMsgpack
	dec := codec.NewDecoder(r, nnMsgpackHandle)
	if err := dec.Decode(&d); err != nil {
		return nil, err
	}
	lshs, err := bit.LoadArray(r)
	if err != nil {
		return nil, err
	}
	return &EuclidLSH{
		lshs:  lshs,
		norms: d.Norms,

		cosTable: cosTable(lshs.BitNum()),
	}, nil
}