Fix foma format parser
diff --git a/datokenizer_test.go b/datokenizer_test.go
index 8945f91..f714e10 100644
--- a/datokenizer_test.go
+++ b/datokenizer_test.go
@@ -1,7 +1,6 @@
package datokenizer
import (
- "strings"
"testing"
"github.com/stretchr/testify/assert"
@@ -11,30 +10,23 @@
assert := assert.New(t)
// bau | bauamt
- r := strings.NewReader(`##foma-net 1.0##
-##props##
-1 6 7 8 2 2 1 1 1 1 1 2 5B57D486
-##sigma##
-0 @_EPSILON_SYMBOL_@
-3 a
-4 b
-5 m
-6 t
-7 u
-##states##
-0 4 1 0
-1 3 2 0
-2 7 3 0
-3 3 4 1
-4 5 5 0
-5 6 6 0
-6 -1 -1 1
--1 -1 -1 -1 -1
-##end##`)
-
- tok := parse(r) // ("tokenizer.fst")
+ tok := parse_file("testdata/bauamt.fst")
tok.buildDA()
assert.True(tok.match("bau"))
assert.True(tok.match("bauamt"))
assert.False(tok.match("baum"))
}
+
+func TestSimpleBranches(t *testing.T) {
+ assert := assert.New(t)
+
+ // (bau | wahl) (amt | en)
+ tok := parse_file("testdata/wahlamt.fst")
+ tok.buildDA()
+ assert.False(tok.match("bau"))
+ assert.True(tok.match("bauamt"))
+ assert.True(tok.match("wahlamt"))
+ assert.True(tok.match("bauen"))
+ assert.True(tok.match("wahlen"))
+ assert.False(tok.match("baum"))
+}