@SuppressWarnings("OptionalGetWithoutIsPresent")
    @Test
    public void testEmbedToSparseTensor() {
        var tester = new EmbeddingScriptTester(Map.of("emb1", new EmbeddingScriptTester.MockMappedEmbedder("myDocument.mySparseTensor", 0)));

        TensorType tensorType = TensorType.fromSpec("tensor(t{})");
        var expression = tester.expressionFrom("input text | embed | attribute 'mySparseTensor'");

        SimpleTestAdapter adapter = new SimpleTestAdapter();
        adapter.createField(new Field("text", DataType.STRING));

        var tensorField = new Field("mySparseTensor", new TensorDataType(tensorType));
        adapter.createField(tensorField);

        var text = new StringFieldValue("abc");
        adapter.setValue("text", text);
        expression.setStatementOutput(new DocumentType("myDocument"), tensorField);

        expression.resolve(new TypeContext(adapter));

        ExecutionContext context = new ExecutionContext(adapter);
        context.setCurrentValue(text);
        expression.execute(context);
        assertTrue(adapter.values.containsKey("mySparseTensor"));
        var sparseTensor = (TensorFieldValue) adapter.values.get("mySparseTensor");
        assertEquals(Tensor.from(tensorType, "tensor(t{}):{97:97.0, 98:98.0, 99:99.0}"),
                     sparseTensor.getTensor().get());
        assertEquals("Cached value always set by MockMappedEmbedder is present",
                     "myCachedValue", context.getCachedValue("myCacheKey"));
    }
Multiple paragraphs, and each paragraph leading to multiple vectors (ColBert style)
indexinglanguage/src/test/java/com/yahoo/vespa/indexinglanguage/EmbeddingScriptTestCase.java