Add trimming at the beginning of a text
Change-Id: I0efec3a718e87be747a6eb09b9890c354f99eb6f
diff --git a/matrix_test.go b/matrix_test.go
index 5678f5e..e27dd12 100644
--- a/matrix_test.go
+++ b/matrix_test.go
@@ -921,7 +921,21 @@
assert.True(mat.Transduce(strings.NewReader("Erste.\n\n\n\n\x04\x0aNächst.\x04"), w))
matStr := w.String()
assert.Equal("Erste\n.\n\n\nNächst\n.\n\n\n", matStr)
+}
+func TestMatrixTrimming(t *testing.T) {
+ assert := assert.New(t)
+
+ mat := LoadMatrixFile("testdata/tokenizer.matok")
+
+ assert.NotNil(mat)
+
+ b := make([]byte, 0, 2048)
+ w := bytes.NewBuffer(b)
+
+ assert.True(mat.Transduce(strings.NewReader(" Erste."), w))
+ matStr := w.String()
+ assert.Equal("Erste\n.\n\n\n", matStr)
}
func BenchmarkMatrixTransduce(b *testing.B) {