mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -06:00
added start category S to Trigram.gf
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
abstract Trigram = {
|
abstract Trigram = {
|
||||||
|
|
||||||
cat
|
cat
|
||||||
|
-- A sentence
|
||||||
|
S ;
|
||||||
|
|
||||||
-- A lexicon is a set of 'Word's
|
-- A lexicon is a set of 'Word's
|
||||||
Word ;
|
Word ;
|
||||||
|
|
||||||
@@ -17,6 +20,8 @@ cat
|
|||||||
Prob (a,b,c : Word) ;
|
Prob (a,b,c : Word) ;
|
||||||
|
|
||||||
data
|
data
|
||||||
|
sent : ({a,b} : Word) -> Seq a b -> S ;
|
||||||
|
|
||||||
-- Here we construct sequence by using nil and cons. The Prob argument ensures
|
-- 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
|
-- that the sequence contains only valid N-grams and contributes with the right
|
||||||
-- probability mass
|
-- probability mass
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
concrete TrigramCnc of Trigram = {
|
concrete TrigramCnc of Trigram = {
|
||||||
|
|
||||||
lincat
|
lincat
|
||||||
Word,Seq = Str;
|
S,Word,Seq = Str;
|
||||||
|
|
||||||
Unigram, Bigram, Trigram, Prob = {} ;
|
Unigram, Bigram, Trigram, Prob = {} ;
|
||||||
|
|
||||||
lin
|
lin
|
||||||
|
sent _ _ l = l ;
|
||||||
nil a b c _ = a ++ b ++ c ;
|
nil a b c _ = a ++ b ++ c ;
|
||||||
cons _ _ l c _ = l ++ c ;
|
cons _ _ l c _ = l ++ c ;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user