bigram.go raw

   1  package lattice
   2  
   3  // BigramKey is the key for the segment pair (prev, next) at a stage, built by
   4  // hashing "prev|next" with HashBytes. iskra/bigram.mx BigramKey.
   5  func BigramKey(stage uint8, prev, next []byte) Key {
   6  	combined := make([]byte, 0, len(prev)+1+len(next))
   7  	combined = append(combined, prev...)
   8  	combined = append(combined, '|')
   9  	combined = append(combined, next...)
  10  	return MakeKey(stage, HashBytes(combined))
  11  }
  12