Codebook learning is a powerful technique of signal representation and encoding used in many ares of computer vision (image enhancement, denoising, compression etc). Google “K-SVD” for example of sparse coding.
There are few approach that allow to use codebooks in DL frameworks for example: VQ-VAE https://arxiv.org/pdf/1711.00937.pdf 6 , and Memory Networks https://arxiv.org/pdf/1410.3916.pdf 4
Hope it will help.