@Override
        public Tensor embed(String text, Context context, TensorType tensorType) {
            if (tensorType.dimensions().size() != 1)
                throw new IllegalArgumentException("Error in embedding to type '" + tensorType + "': should only have one dimension.");
            if (!tensorType.dimensions().get(0).isIndexed())
                throw new IllegalArgumentException("Error in embedding to type '" + tensorType + "': dimension should be indexed.");
            boolean binarize = tensorType.valueType() == TensorType.Value.INT8;
            long size = tensorType.dimensions().get(0).size().get();
            if (binarize)
                size = size * 8;
            var embeddedType = new TensorType.Builder().indexed(tensorType.dimensions().get(0).name(), size).build();
            var resultBuilder = Tensor.Builder.of(embeddedType);
            for (int i = 0; i < size; i++) {
                int v = ((i % 3) == 0) ? 1 : 0;
                resultBuilder.cell(v, i);
            }
            var result = resultBuilder.build();
            if (binarize)
                result = Tensors.packBits(result);
             return result;
        }
An embedder which also does its own quantization, similar to HuggingFaceEmbedder.
docprocs/src/test/java/com/yahoo/docprocs/indexing/IndexingProcessorTestCase.java