mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-23 01:52:50 -06:00
MAth
This commit is contained in:
@@ -6,7 +6,8 @@ concrete LangEng of Lang =
|
||||
StructuralEng,
|
||||
BasicEng,
|
||||
TimeEng,
|
||||
CountryEng
|
||||
CountryEng,
|
||||
MathEng
|
||||
|
||||
** open Prelude, ParadigmsEng in {
|
||||
|
||||
|
||||
49
lib/resource/english/MathEng.gf
Normal file
49
lib/resource/english/MathEng.gf
Normal file
@@ -0,0 +1,49 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
concrete MathEng of Math = CategoriesEng ** open Prelude, SyntaxEng, ParadigmsEng in {
|
||||
|
||||
lin
|
||||
SymbPN i = {s = \\c => caseSymb c i.s ; g = Neutr} ;
|
||||
IntPN i = {s = \\c => caseSymb c i.s ; g = Neutr} ;
|
||||
IntNP cn i = nameNounPhrase {
|
||||
s = \\c => (cn.s ! Sg ! Nom ++ caseSymb c i.s) ;
|
||||
g = Neutr
|
||||
} ;
|
||||
|
||||
IndefSymbNumNP nu cn xs =
|
||||
addSymbNounPhrase (indefNounPhraseNum plural nu cn) xs.s ;
|
||||
DefSymbNumNP nu cn xs =
|
||||
addSymbNounPhrase (defNounPhraseNum plural nu cn) xs.s ;
|
||||
NDetSymbNP det nu cn xs =
|
||||
addSymbNounPhrase (numDetNounPhrase det nu cn) xs.s ;
|
||||
|
||||
lincat
|
||||
SymbList = SS ;
|
||||
|
||||
lin
|
||||
SymbTwo = infixSS "and" ;
|
||||
SymbMore = infixSS "," ;
|
||||
|
||||
|
||||
LetCN x cn = {
|
||||
s = \\_ => "let" ++ x.s ++ "be" ++ (indefNounPhrase singular cn).s ! NomP
|
||||
} ;
|
||||
LetNumCN x nu cn = {
|
||||
s = \\_ => "let" ++ x.s ++ "be" ++ (indefNounPhraseNum plural nu cn).s ! NomP
|
||||
} ;
|
||||
ExistNP np = predVerbClause
|
||||
(nameNounPhraseN (fromAgr np.a).n (nameReg "there" Neutr))
|
||||
(regV "exist")
|
||||
(complNounPhrase np) ;
|
||||
|
||||
-- Moved from $RulesEng$.
|
||||
|
||||
SymbCN cn s =
|
||||
{s = \\n,c => cn.s ! n ! Nom ++ caseSymb c s.s ;
|
||||
g = cn.g} ;
|
||||
IntCN cn s =
|
||||
{s = \\n,c => cn.s ! n ! Nom ++ caseSymb c s.s ;
|
||||
g = cn.g} ;
|
||||
|
||||
|
||||
}
|
||||
@@ -28,14 +28,6 @@ lin
|
||||
UseN = noun2CommNounPhrase ;
|
||||
UsePN = nameNounPhrase ;
|
||||
|
||||
SymbPN i = {s = table {Nom => i.s ; Gen => i.s ++ "'s"} ; g = Neutr} ; ---
|
||||
SymbCN cn s =
|
||||
{s = \\n,c => cn.s ! n ! c ++ s.s ;
|
||||
g = cn.g} ;
|
||||
IntCN cn s =
|
||||
{s = \\n,c => cn.s ! n ! c ++ s.s ;
|
||||
g = cn.g} ;
|
||||
|
||||
IndefOneNP = indefNounPhrase singular ;
|
||||
IndefNumNP = indefNounPhraseNum plural ;
|
||||
DefOneNP = defNounPhrase singular ;
|
||||
|
||||
@@ -66,11 +66,17 @@ oper
|
||||
APl p => {n = Pl ; p = p ; g = human}
|
||||
} ;
|
||||
|
||||
nameNounPhrase : ProperName -> NounPhrase = \john ->
|
||||
{s = \\c => john.s ! toCase c ; a = toAgr Sg P3 john.g} ;
|
||||
caseSymb : Case -> Str -> Str = \c,i -> case c of {
|
||||
Nom => i ;
|
||||
Gen => glue i "'s"
|
||||
} ;
|
||||
|
||||
nameNounPhrasePl : ProperName -> NounPhrase = \john ->
|
||||
{s = \\c => john.s ! toCase c ; a = toAgr Pl P3 john.g} ;
|
||||
nameNounPhrase : ProperName -> NounPhrase =
|
||||
nameNounPhraseN Sg ;
|
||||
nameNounPhrasePl : ProperName -> NounPhrase =
|
||||
nameNounPhraseN Pl ;
|
||||
nameNounPhraseN : Number -> ProperName -> NounPhrase = \n,john ->
|
||||
{s = \\c => john.s ! toCase c ; a = toAgr n P3 john.g} ;
|
||||
|
||||
-- The following construction has to be refined for genitive forms:
|
||||
-- "we two", "us two" are OK, but "our two" is not.
|
||||
@@ -86,6 +92,14 @@ oper
|
||||
pronNounPhrase : Pronoun -> NounPhrase = \pro ->
|
||||
{s = pro.s ; a = toAgr pro.n pro.p pro.g} ;
|
||||
|
||||
-- To add a symbol, such as a variable or variable list, to the end of
|
||||
-- an NP.
|
||||
|
||||
addSymbNounPhrase : NounPhrase -> Str -> NounPhrase = \np,x ->
|
||||
{s = \\c => np.s ! c ++ x ;
|
||||
a = np.a
|
||||
} ;
|
||||
|
||||
--2 Determiners
|
||||
--
|
||||
-- Determiners are inflected according to the nouns they determine.
|
||||
|
||||
Reference in New Issue
Block a user