forked from GitHub/gf-core
disambiguation in Phrasebook grammars, PGF server, and the GUI
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
incomplete concrete SentencesI of Sentences = Numeral **
|
||||
open
|
||||
DiffPhrasebook,
|
||||
Syntax
|
||||
Syntax,
|
||||
(R = Roles),
|
||||
Prelude
|
||||
in {
|
||||
lincat
|
||||
Phrase = Text ;
|
||||
Sentence = S ;
|
||||
Question = QS ;
|
||||
Politeness = {s : Str ; p : R.Politeness} ;
|
||||
Sentence = {s : R.Politeness => S} ;
|
||||
Question = {s : R.Politeness => QS} ;
|
||||
Item = NP ;
|
||||
Kind = CN ;
|
||||
Quality = AP ;
|
||||
@@ -15,10 +18,16 @@ incomplete concrete SentencesI of Sentences = Numeral **
|
||||
PlaceKind = CN ;
|
||||
Currency = CN ;
|
||||
Price = NP ;
|
||||
Action = Cl ;
|
||||
Person = NP ;
|
||||
Action = {s : R.Politeness => Cl} ;
|
||||
Person = {s : R.Politeness => NP} ;
|
||||
Language = NP ;
|
||||
lin
|
||||
--- todo: add speaker and hearer genders
|
||||
PSentence p g = let s = g.s ! p.p in
|
||||
mkText (mkText s | lin Text (mkUtt s)) (lin Text (ss p.s)) ; -- optional '.'
|
||||
PQuestion p g = let s = g.s ! p.p in
|
||||
mkText (mkText s | lin Text (mkUtt s)) (lin Text (ss p.s)) ; -- optional '?'
|
||||
|
||||
PObject x = mkPhrase (mkUtt x) ;
|
||||
PKind x = mkPhrase (mkUtt x) ;
|
||||
PQuality x = mkPhrase (mkUtt x) ;
|
||||
@@ -29,17 +38,18 @@ incomplete concrete SentencesI of Sentences = Numeral **
|
||||
PPrice x = mkPhrase (mkUtt x) ;
|
||||
PLanguage x = mkPhrase (mkUtt x) ;
|
||||
|
||||
Is item quality = mkS (mkCl item quality) ;
|
||||
IsNot item quality = mkS negativePol (mkCl item quality) ;
|
||||
WhetherIs item quality = mkQS (mkQCl (mkCl item quality)) ;
|
||||
WhereIs place = mkQS (mkQCl where_IAdv place) ;
|
||||
Is item quality = neutralS (mkS (mkCl item quality)) ;
|
||||
IsNot item quality = neutralS (mkS negativePol (mkCl item quality)) ;
|
||||
WhetherIs item quality = neutralQS (mkQS (mkQCl (mkCl item quality))) ;
|
||||
WhereIs place = neutralQS (mkQS (mkQCl where_IAdv place)) ;
|
||||
|
||||
SAction = mkS ;
|
||||
SNotAction = mkS negativePol ;
|
||||
QAction a = mkQS (mkQCl a) ;
|
||||
SAction a = {s = \\p => mkS (a.s ! p)} ;
|
||||
SNotAction a = {s = \\p => mkS negativePol (a.s ! p)} ;
|
||||
QAction a = {s = \\p => mkQS (mkQCl (a.s ! p))} ;
|
||||
|
||||
HowMuchCost item = mkQS (mkQCl how8much_IAdv (mkCl item cost_V)) ;
|
||||
ItCost item price = mkS (mkCl item cost_V2 price) ;
|
||||
HowMuchCost item = neutralQS (mkQS (mkQCl how8much_IAdv (mkCl item cost_V))) ;
|
||||
ItCost item price = neutralS (mkS (mkCl item cost_V2 price)) ;
|
||||
|
||||
AmountCurrency num curr = mkNP <lin Numeral num : Numeral> curr ;
|
||||
|
||||
ObjItem i = i ;
|
||||
@@ -57,10 +67,23 @@ incomplete concrete SentencesI of Sentences = Numeral **
|
||||
Too quality = mkAP too_AdA quality ;
|
||||
ThePlace kind = mkNP the_Quant kind ;
|
||||
|
||||
I = mkNP i_Pron ;
|
||||
You = mkNP youPol_Pron ;
|
||||
I = {s = \\_ => mkNP i_Pron} ;
|
||||
You = {s = table {R.PPolite => mkNP youPol_Pron ; R.PFamiliar => mkNP youSg_Pron}} ;
|
||||
|
||||
Polite = {s = [] ; p = R.PPolite} ;
|
||||
Familiar = {s = [] ; p = R.PFamiliar} ;
|
||||
-- Male = {s = [] ; g = R.Male} ;
|
||||
-- Female = {s = [] ; g = R.Female} ;
|
||||
|
||||
oper
|
||||
mkPhrase : Utt -> Text = \u -> lin Text u ; -- no punctuation
|
||||
|
||||
politeS : S -> S -> {s : R.Politeness => S} = \pol,fam ->
|
||||
{s = table {R.PPolite => pol ; R.PFamiliar => fam}} ;
|
||||
neutralS : S -> {s : R.Politeness => S} = \pol -> politeS pol pol ;
|
||||
politeQS : QS -> QS -> {s : R.Politeness => QS} = \pol,fam ->
|
||||
{s = table {R.PPolite => pol ; R.PFamiliar => fam}} ;
|
||||
neutralQS : QS -> {s : R.Politeness => QS} = \pol -> politeQS pol pol ;
|
||||
---- it would be greate to use overloading here
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user