1
0
forked from GitHub/gf-core
This commit is contained in:
aarne
2005-09-15 15:22:00 +00:00
parent efaafffb77
commit 7df1ff9409
30 changed files with 412 additions and 55 deletions

View File

@@ -6,7 +6,8 @@ abstract Lang =
Structural,
Basic,
Time,
Country
Country,
Math
** {
fun

View File

@@ -0,0 +1,52 @@
abstract Math = Categories ** {
--3 Noun phrases with symbols
fun
SymbPN : String -> PN ; -- "x"
IntPN : Int -> PN ; -- "27"
IntNP : CN -> Int -> NP ; -- "level 53"
IndefSymbNumNP : Num -> CN -> SymbList -> NP ; -- "(2) numbers x and y"
DefSymbNumNP : Num -> CN -> SymbList -> NP ; -- "the (2) numbers x and y"
NDetSymbNP : NDet -> Num -> CN -> SymbList -> NP ; -- "some (3) points x, y and z"
--3 Symbol lists
-- A symbol list has at least two elements. The last two are separated
-- by a conjunction ("and" in English), the others by commas.
-- This produces "x, y and z", in English.
cat
SymbList ;
fun
SymbTwo : String -> String -> SymbList ;
SymbMore : String -> SymbList -> SymbList ;
--3 Special forms of expression
-- These expression forms are typical of mathematical texts.
LetCN : String -> CN -> Imp ; -- Let x be a number.
LetNumCN : SymbList -> Num -> CN -> Imp ; -- Let x and y be (2) numbers.
-- This rule is slightly overgenerating: "there exists every number x".
-- The problem seems to be of semantic nature. By this we avoid having many rules.
ExistNP : NP -> Cl ; -- there exist (2) number(s) x and y
--3 Rules moved from $Rules$.
-- This rule is powerful but overgenerating.
SymbCN : CN -> String -> CN ; -- "number x"
-- This rule is simply wrong, and will be deprecated: the correct
-- value type is $NP$.
IntCN : CN -> Int -> CN ; -- "level 53"
}

View File

@@ -17,9 +17,12 @@ fun
UseN : N -> CN ; -- "car"
UsePN : PN -> NP ; -- "John"
-- These three rules have been moved to the module $Math$.
{-
SymbPN : String -> PN ; -- "x"
SymbCN : CN -> String -> CN ; -- "number x"
IntCN : CN -> Int -> CN ; -- "number 53"
-}
IndefOneNP : CN -> NP ; -- "a car", "cars"
IndefNumNP : Num -> CN -> NP ; -- "houses", "86 houses"

View File

@@ -0,0 +1,4 @@
--# -path=.:../scandinavian:../abstract:../../prelude
concrete MathDan of Math = CategoriesDan **
MathScand with (SyntaxScand=SyntaxDan) ;

View File

@@ -116,4 +116,5 @@ instance SyntaxDan of SyntaxScand = TypesDan **
{s = verbVara.s ; s1 = "ved" ; isAux = False}
vp) ;
conjEt = "og" ;
}

View File

@@ -6,7 +6,8 @@ concrete LangEng of Lang =
StructuralEng,
BasicEng,
TimeEng,
CountryEng
CountryEng,
MathEng
** open Prelude, ParadigmsEng in {

View 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} ;
}

View File

@@ -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 ;

View File

@@ -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.

View File

@@ -4,9 +4,10 @@ concrete LangFin of Lang =
RulesFin,
ClauseFin,
StructuralFin,
BasicFin
BasicFin,
---- TimeEng,
---- CountryEng
MathFin
** open Prelude, ParadigmsFin in {

View File

@@ -0,0 +1,50 @@
--# -path=.:../abstract:../../prelude
concrete MathFin of Math = CategoriesFin ** open Prelude, SyntaxFin, ParadigmsFin in {
lin
SymbPN i = {s = \\c => i.s} ; --- case endings often needed
IntPN i = {s = \\c => i.s} ;
IntNP cn i = nameNounPhrase {
s = \\c => cn.s ! False ! Sg ! c ++ i.s
} ;
IndefSymbNumNP nu cn xs =
addSymbNounPhrase (nounPhraseNum False nu cn) xs.s ;
DefSymbNumNP nu cn xs =
addSymbNounPhrase (nounPhraseNum True nu cn) xs.s ;
NDetSymbNP det nu cn xs =
addSymbNounPhrase (numDetNounPhrase det nu cn) xs.s ;
lincat
SymbList = SS ;
lin
SymbTwo = infixSS "ja" ;
SymbMore = infixSS "," ;
LetCN x cn = {
s = \\_ => "olkoon" ++ x.s ++ (indefNounPhrase singular cn).s !
NPCase Nom
} ;
LetNumCN x nu cn = {
s = \\_ => "olkoot" ++ x.s ++ (nounPhraseNum False nu cn).s
! NPCase Part
} ;
ExistNP np =
sats2clause (
mkSatsCopula impersNounPhrase ("olemassa" ++ np.s ! NPCase Nom)
) ;
-- Moved from $RulesFin$.
SymbCN cn s =
{s = \\f,n,c => cn.s ! f ! n ! c ++ s.s ;
g = cn.g} ;
IntCN cn s =
{s = \\f,n,c => cn.s ! f ! n ! c ++ s.s ;
g = cn.g} ;
}

View File

@@ -24,14 +24,6 @@ lin
UseN = noun2CommNounPhrase ;
UsePN = nameNounPhrase ;
SymbPN i = {s = \\_ => i.s} ; --- case endings often needed
SymbCN cn s =
{s = \\f,n,c => cn.s ! f ! n ! c ++ s.s ;
g = cn.g} ;
IntCN cn s =
{s = \\f,n,c => cn.s ! f ! n ! c ++ s.s ;
g = cn.g} ;
IndefOneNP = indefNounPhrase singular ;
IndefNumNP = nounPhraseNum False ;
DefOneNP = defNounPhrase singular ;
@@ -206,6 +198,8 @@ lin
---- OneNP = nameNounPhrase (nameReg "one" human) ;
--- should be partitive in negative forms: "ei ole olemassa puista autoa"
ExistCN cn =
sats2clause (
mkSatsCopula impersNounPhrase ("olemassa" ++ (singularNounPhrase cn).s ! NPCase Nom)

View File

@@ -157,6 +157,14 @@ oper
noNum : Numeral = {s = \\_ => [] ; isNum = False ; n = Pl} ;
-- 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 ;
n = np.n ;
p = np.p
} ;
--2 Determiners
--

View File

@@ -0,0 +1,4 @@
--# -path=.:../romance:../abstract:../../prelude
concrete MathFre of Math = CategoriesFre **
MathRomance with (SyntaxRomance=SyntaxFre) ;

View File

@@ -0,0 +1,4 @@
--# -path=.:../romance:../abstract:../../prelude
concrete MathIta of Math = CategoriesIta **
MathRomance with (SyntaxRomance=SyntaxIta) ;

View File

@@ -0,0 +1,4 @@
--# -path=.:../scandinavian:../abstract:../../prelude
concrete MathNor of Math = CategoriesNor **
MathScand with (SyntaxScand=SyntaxNor) ;

View File

@@ -117,4 +117,7 @@ instance SyntaxNor of SyntaxScand = TypesNor **
(complVerbVerb
({s = verbVara.s ; s1 = "ved" ; isAux = False})
vp) ;
conjEt = "og" ;
}

View File

@@ -0,0 +1,51 @@
--# -path=.:../romance:../abstract:../../prelude
incomplete concrete MathRomance of Math = CategoriesRomance **
open Prelude, SyntaxRomance in {
lin
SymbPN i = {s = i.s ; g = Masc} ; --- cannot know gender
IntPN i = {s = i.s ; g = Masc} ;
IntNP cn i = nameNounPhrase {
s = cn.s ! Sg ++ i.s ;
g = cn.g
} ;
IndefSymbNumNP nu cn xs =
addSymbNounPhrase (indefNounPhraseNum nu cn) xs.s ;
DefSymbNumNP nu cn xs =
addSymbNounPhrase (defNounPhraseNum nu cn) xs.s ;
NDetSymbNP det nu cn xs =
addSymbNounPhrase (numDetNounPhrase det nu cn) xs.s ;
lincat
SymbList = SS ;
lin
SymbTwo = infixSS etConj.s ;
SymbMore = infixSS "," ;
LetCN x cn = {
s = \\_,_ => copula.s ! VFin (VPres Con) Sg P3 ++ x.s ++ (indefNounPhrase singular cn).s !
unstressed nominative
} ;
LetNumCN x nu cn = {
s = \\_,_ => copula.s ! VFin (VPres Con) Pl P3 ++ x.s ++ (indefNounPhraseNum nu cn).s
! unstressed nominative
} ;
--- to be replaced by "il existe", "esiste", etc.
ExistNP np = existNounPhrase np ;
-- Moved from $RulesRomance$.
SymbCN cn s =
{s = \\n => cn.s ! n ++ s.s ;
g = cn.g} ;
IntCN cn i =
{s = \\n => cn.s ! n ++ i.s ;
g = cn.g} ;
}

View File

@@ -7,14 +7,6 @@ lin
UseN = noun2CommNounPhrase ;
UsePN = nameNounPhrase ;
SymbPN i = {s = i.s ; g = Masc} ; --- cannot know gender
SymbCN cn s =
{s = \\n => cn.s ! n ++ s.s ;
g = cn.g} ;
IntCN cn i =
{s = \\n => cn.s ! n ++ i.s ;
g = cn.g} ;
IndefOneNP = indefNounPhrase singular ;
IndefNumNP = indefNounPhraseNum ;
DefOneNP = defNounPhrase singular ;

View File

@@ -80,6 +80,17 @@ oper
existNounPhrase : NounPhrase -> Clause ;
-- 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 ;
g = np.g ;
n = np.n ;
p = np.p ;
c = np.c
} ;
--2 Determiners
--

View File

@@ -0,0 +1,58 @@
--# -path=.:../abstract:../../prelude
incomplete concrete MathScand of Math = CategoriesScand **
open Prelude, SyntaxScand in {
lin
SymbPN i = {s = \\_ => i.s ; g = NNeutr} ; --- cannot know gender
IntPN i = {s = \\_ => i.s ; g = NNeutr} ;
IntNP cn i = nameNounPhrase {
s = \\c => cn.s ! Sg ! DefP Def ! Nom ++ i.s ;
g = cn.g
} ;
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 conjEt ;
SymbMore = infixSS "," ;
LetCN x cn = {
s = \\_ => letImp ++ x.s ++ verbVara.s ! VI (Inf Act) ++ (indefNounPhrase singular cn).s !
PNom
} ;
LetNumCN x nu cn = {
s = \\_ => letImp ++ x.s ++ verbVara.s ! VI (Inf Act) ++
(indefNounPhraseNum plural nu cn).s
! PNom
} ;
--- to be replaced by "det existerar", etc.
ExistNP np = predVerbGroupClause npDet
(complTransVerb (mkDirectVerb (deponentVerb verbFinnas))
np) ;
-- Moved from $RulesScand$.
SymbCN cn s =
{s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ;
g = cn.g ;
p = cn.p
} ;
IntCN cn s =
{s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ;
g = cn.g ;
p = cn.p
} ;
}

View File

@@ -10,16 +10,13 @@ lin
UsePN = nameNounPhrase ;
SymbPN i = {s = \\_ => i.s ; g = NNeutr} ;
SymbCN cn s =
{s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ;
g = cn.g ;
p = cn.p
} ;
IntCN cn s =
{s = \\a,n,c => cn.s ! a ! n ! c ++ s.s ;
g = cn.g ;
p = cn.p
} ;
{s = \\n => cn.s ! n ++ s.s ;
g = cn.g} ;
IntCN cn i =
{s = \\n => cn.s ! n ++ i.s ;
g = cn.g} ;
IndefOneNP = indefNounPhrase singular ;
IndefNumNP = indefNounPhraseNum plural ;

View File

@@ -122,6 +122,11 @@ oper
npDet : NounPhrase ;
addSymbNounPhrase : NounPhrase -> Str -> NounPhrase = \np,x ->
{s = \\c => np.s ! c ++ x ; g = np.g ; n = np.n ; p = np.p} ;
--2 Determiners
--
-- Determiners are inflected according to noun in gender and sex.
@@ -1710,4 +1715,7 @@ oper
pronVars, pronVem, pronVems : Str ;
conjEt : Str ;
letImp : Str = "låt" ; ---- check for all scand
} ;

View File

@@ -0,0 +1,4 @@
--# -path=.:../romance:../abstract:../../prelude
concrete MathSpa of Math = CategoriesSpa **
MathRomance with (SyntaxRomance=SyntaxSpa) ;

View File

@@ -0,0 +1,4 @@
--# -path=.:../scandinavian:../abstract:../../prelude
concrete MathSwe of Math = CategoriesSwe **
MathScand with (SyntaxScand=SyntaxSwe) ;

View File

@@ -132,4 +132,7 @@ instance SyntaxSwe of SyntaxScand = TypesSwe **
CPpå => "på" ;
CPtill => "till"
} ;
conjEt = "och" ;
}