forked from GitHub/gf-core
added start category S to Trigram.gf
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
abstract Trigram = {
|
||||
|
||||
cat
|
||||
-- A sentence
|
||||
S ;
|
||||
|
||||
-- A lexicon is a set of 'Word's
|
||||
Word ;
|
||||
|
||||
@@ -17,6 +20,8 @@ cat
|
||||
Prob (a,b,c : Word) ;
|
||||
|
||||
data
|
||||
sent : ({a,b} : Word) -> Seq a b -> S ;
|
||||
|
||||
-- Here we construct sequence by using nil and cons. The Prob argument ensures
|
||||
-- that the sequence contains only valid N-grams and contributes with the right
|
||||
-- probability mass
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
concrete TrigramCnc of Trigram = {
|
||||
|
||||
lincat
|
||||
Word,Seq = Str;
|
||||
S,Word,Seq = Str;
|
||||
|
||||
Unigram, Bigram, Trigram, Prob = {} ;
|
||||
|
||||
lin
|
||||
sent _ _ l = l ;
|
||||
nil a b c _ = a ++ b ++ c ;
|
||||
cons _ _ l c _ = l ++ c ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user