Merge branch 'GrammaticalFramework:master' into master

This commit is contained in:
Arianna Masciolini
2023-08-23 13:16:46 +02:00
committed by GitHub
374 changed files with 97632 additions and 93683 deletions

33
.github/workflows/test.yml vendored Normal file
View File

@@ -0,0 +1,33 @@
name: Check that the RGL can successfully build
on:
- push
- pull_request
jobs:
build:
runs-on: ubuntu-20.04
env:
GF_VERSION: 3.11
DEST: gf-rgl
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Download GF
uses: dsaltares/fetch-gh-release-asset@1.1.1
with:
repo: 'GrammaticalFramework/gf-core'
version: 'tags/${{ env.GF_VERSION }}'
file: 'gf-${{ env.GF_VERSION }}-ubuntu-20.04.deb'
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install GF
run: |
sudo dpkg -i gf-${GF_VERSION}-ubuntu-20.04.deb
- name: Build RGL
run: |
mkdir -p ${DEST}
bash Setup.sh --dest=${DEST} --gf=gf --verbose

View File

@@ -7,8 +7,6 @@ Aarne Ranta
The following table gives the languages currently available in the
GF Resource Grammar Library.
For another view, see the
[The Resource Grammar Library coverage map http://www.postcrashgames.com/gf_world/] .
Corrections and additions are welcome! Notice that only those parts of implementations
that are currently available via https://github.com/GrammaticalFramework/gf-rgl/

View File

@@ -32,7 +32,6 @@ the library, view all functions in a module's scope, and quickly jump to their d
Other relevant documents:
- [The RGL Status Document ../status.html]: the current status of different languages
and the authors of each grammar
- [The Resource Grammar Library coverage map http://www.postcrashgames.com/gf_world/]
- [RGL Documentation and Publications ../rgl-publications.html]: links to publications and other documentation
- [More modules ../gfdoc/sources.html]: extra modules, dictionaries, and
the internals of the resource grammar

View File

@@ -52,3 +52,4 @@ Tha,Thai,thai,,to_thai,,,,,,y
Tur,Turkish,turkish,,,y,,,n,,n
Urd,Urdu,urdu,Hindustani,,,,,,,y
Som,Somali,somali,,,,,n,n,,n
Zul,Zulu,zulu,,,,,n,n,,n
1 Code Name Directory Functor Unlexer Present All Try Symbolic Compatibility Synopsis
52 Tur Turkish turkish y n n
53 Urd Urdu urdu Hindustani y
54 Som Somali somali n n n
55 Zul Zulu zulu n n n

View File

@@ -93,6 +93,7 @@ abstract Cat = Common ** {
Numeral ; -- cardinal or ordinal in words e.g. "five/fifth"
Digits ; -- cardinal or ordinal in digits e.g. "1,000/1,000th"
Decimal ; -- decimal number e.g. "1/2/3.14/-1"
--2 Structural words
@@ -128,7 +129,8 @@ abstract Cat = Common ** {
N3 ; -- three-place relational noun e.g. "connection"
GN ; -- given name e.g. "George"
SN ; -- second name e.g. "Washington"
PN ; -- proper name e.g. "Paris"
LN ; -- location name e.g. "Sweden"
PN ; -- proper name
-- DEPRECATED: QuantSg, QuantPl
--- QuantSg ;-- quantifier ('nucleus' of sing. Det) e.g. "every"

View File

@@ -44,4 +44,8 @@ abstract Common = {
Pol ; -- polarity e.g. positive, negative
Ant ; -- anteriority e.g. simultaneous, anterior
--2 Measures
MU ; -- unit of measurement e.g. "km", "cm", "%"
}

View File

@@ -14,6 +14,7 @@ fun
InflectionN2 : N2 -> Inflection ;
InflectionN3 : N3 -> Inflection ;
InflectionPN : PN -> Inflection ;
InflectionLN : LN -> Inflection ;
InflectionGN : GN -> Inflection ;
InflectionSN : SN -> Inflection ;
InflectionA : A -> Inflection ;

View File

@@ -27,9 +27,11 @@ abstract Extend = Cat ** {
CompBareCN : CN -> Comp ; -- (is) teacher
PiedPipingQuestSlash : IP -> ClSlash -> QCl ; -- with whom does John live
PiedPipingRelSlash : RP -> ClSlash -> RCl ; -- with whom John lives
StrandQuestSlash : IP -> ClSlash -> QCl ; -- whom does John live with
StrandRelSlash : RP -> ClSlash -> RCl ; -- that he lives in
EmptyRelSlash : ClSlash -> RCl ; -- he lives in
StrandRelSlash : RP -> ClSlash -> RCl ; -- that he lives with
EmptyRelSlash : ClSlash -> RCl ; -- he lives with
-- $VP$ conjunction, separate categories for finite and infinitive forms (VPS and VPI, respectively)
@@ -291,13 +293,11 @@ fun UseDAP : DAP -> NP ;
cat X ; -- for words that are difficult to classify, mainly for MorphoDict
fun
CardCNCard : Card -> CN -> Card ; -- three million, four lakh, six dozen etc
UseComp_estar : Comp -> VP ; -- esta lleno, as opposed to es lleno
UseComp_ser : Comp -> VP ; -- es lleno, as opposed to esta lleno
GivenName : GN -> PN ;
MaleSurname : SN -> PN ;
FemaleSurname : SN -> PN ;
PlSurname : SN -> PN ;
FullName : GN -> SN -> PN ;
fun
CardCNCard : Card -> CN -> Card ; -- three million, four lakh, six dozen etc
fun
AnaphPron : NP -> Pron ;

View File

@@ -19,6 +19,6 @@ abstract Grammar =
Structural,
Idiom,
Tense,
Names,
Transfer
;

14
src/abstract/Names.gf Normal file
View File

@@ -0,0 +1,14 @@
abstract Names = Cat ** {
fun GivenName : GN -> NP ;
MaleSurname : SN -> NP ;
FemaleSurname : SN -> NP ;
PlSurname : SN -> NP ;
FullName : GN -> SN -> NP ;
fun UseLN : LN -> NP ;
PlainLN : LN -> NP ;
InLN : LN -> Adv ;
AdjLN : AP -> LN -> LN ;
}

View File

@@ -58,6 +58,7 @@ abstract Noun = Cat ** {
data
NumDigits : Digits -> Card ; -- 51
NumDecimal : Decimal -> Card ; -- 3.14, -1, etc
NumNumeral : Numeral -> Card ; -- fifty-one
-- The construction of numerals is defined in [Numeral Numeral.html].
@@ -155,4 +156,8 @@ abstract Noun = Cat ** {
AdjDAP : DAP -> AP -> DAP ; -- the large (one)
DetDAP : Det -> DAP ; -- this (or that)
--2 Quantities
QuantityNP : Decimal -> MU -> NP ;
}

View File

@@ -17,7 +17,7 @@
-- parts of a numeral, which is often incorrect - more work on
-- (un)lexing is needed to solve this problem.
abstract Numeral = Cat [Numeral,Digits] ** {
abstract Numeral = Cat [Numeral,Digits,Decimal] ** {
cat
Digit ; -- 2..9
@@ -53,18 +53,18 @@ data
pot3 : Sub1000 -> Sub1000000 ; -- m * 1000
pot3plus : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
pot3as4 : Sub1000000 -> Sub1000000000 ; -- coercion of 1..999999
pot3float : Float -> Sub1000000 ; -- 3.5 thousand
pot3decimal : Decimal -> Sub1000000 ; -- 3.5 thousand
pot41 : Sub1000000000 ; -- a million instead of one million
pot4 : Sub1000 -> Sub1000000000 ; -- m * 1000000000
pot4plus : Sub1000 -> Sub1000000 -> Sub1000000000 ; -- m * 1000000000 + n
pot4as5 : Sub1000000000 -> Sub1000000000000 ; -- coercion of 1..999999999
pot4float : Float -> Sub1000000000 ; -- 3.5 million
pot4decimal : Decimal -> Sub1000000000 ; -- 3.5 million
pot51 : Sub1000000000000 ; -- a billion instead of one billion
pot5 : Sub1000 -> Sub1000000000000 ; -- m * 1000000000
pot5plus : Sub1000 -> Sub1000000000 -> Sub1000000000000 ; -- m * 1000000000 + n
pot5float : Float -> Sub1000000000000 ; -- 3.5 billion
pot5decimal : Decimal -> Sub1000000000000 ; -- 3.5 billion
-- Numerals as sequences of digits have a separate, simpler grammar
@@ -77,4 +77,8 @@ data
D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 : Dig ;
PosDecimal : Digits -> Decimal ; -- 8
NegDecimal : Digits -> Decimal ; -- -8
IFrac : Decimal -> Dig -> Decimal ; -- 3.14 -> 3.141
}

View File

@@ -62,6 +62,7 @@ concrete CatAfr of Cat =
Numeral = {s : CardOrd => Str ; n : Number } ;
Digits = {s : CardOrd => Str ; n : Number } ;
Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ;
-- Structural
@@ -83,6 +84,9 @@ concrete CatAfr of Cat =
N = Noun ;
N2 = {s : NForm => Str ; g : Gender} ** {c2 : Preposition} ;
N3 = {s : NForm => Str ; g : Gender} ** {c2,c3 : Preposition} ;
GN, SN, PN = {s : NPCase => Str} ;
PN = {s : NPCase => Str} ;
GN = {s : NPCase => Str; g : Sex} ;
SN = {s : Sex => NPCase => Str; pl : NPCase => Str} ;
LN = {s : Adjf => NPCase => Str ; hasArt : Bool ; n : Number} ;
}

View File

@@ -28,6 +28,12 @@ lin
s2 = paragraph (pn.s ! NPNom)
} ;
InflectionLN = \ln -> {
t = "pn" ;
s1 = heading1 "Naam" ;
s2 = paragraph (ln.s ! Strong ! NPNom)
} ;
InflectionGN = \pn -> {
t = "vnm" ;
s1 = heading1 "Voornaam" ;
@@ -37,7 +43,7 @@ lin
InflectionSN = \pn -> {
t = "van" ;
s1 = heading1 "Van" ;
s2 = paragraph (pn.s ! NPNom)
s2 = paragraph (pn.s ! Male ! NPNom)
} ;
InflectionA, InflectionA2 = \adj ->

View File

@@ -1,14 +1,15 @@
concrete ExtendAfr of Extend =
CatAfr ** ExtendFunctor
CatAfr ** ExtendFunctor - [PassVPSlash,PassAgentVPSlash]
with
(Grammar = GrammarAfr) **
open
ResAfr in {
ParadigmsAfr, ResAfr in {
lin GivenName, MaleSurname, FemaleSurname = \n -> n ;
lin FullName gn sn = {
s = \\c => gn.s ! NPNom ++ sn.s ! c ;
} ;
-- KA: guessed from PassV2 in Afrikaans and the equivalents in Dutch
lin PassVPSlash vps =
insertInf (vps.s.s ! VPerf) (predV word_V) ;
PassAgentVPSlash vps np =
insertAdv (appPrep "door" np.s) (insertInf (vps.s.s ! VPerf) (predV word_V)) ;
}

View File

@@ -14,4 +14,5 @@ concrete GrammarAfr of Grammar =
TextX,
IdiomAfr,
StructuralAfr,
TenseX ;
TenseX,
NamesAfr ;

40
src/afrikaans/NamesAfr.gf Normal file
View File

@@ -0,0 +1,40 @@
concrete NamesAfr of Names = CatAfr ** open ResAfr, Prelude in {
lin GivenName = \n -> {s = n.s ; a = agrP3 Sg ; isPron = False} ;
lin MaleSurname = \n -> {s = n.s ! Male ; a = agrP3 Sg ; isPron = False} ;
lin FemaleSurname = \n -> {s = n.s ! Female; a = agrP3 Sg ; isPron = False} ;
lin PlSurname = \n -> {s = n.pl ; a = agrP3 Sg ; isPron = False} ;
lin FullName gn sn =
{s = \\c => gn.s ! NPNom ++ sn.s ! gn.g ! c ; a = agrP3 Sg ; isPron = False} ;
lin UseLN ln = {
s = \\c => case ln.hasArt of {
True => "die" ++ ln.s ! Weak ! c ;
False => ln.s ! Strong ! c
} ;
a = agrP3 ln.n ;
isPron = False
} ;
PlainLN ln = {
s = \\c => ln.s ! Strong ! c ;
a = agrP3 ln.n ;
isPron = False
} ;
InLN ln = {
s = appPrep "in" (\\c => case ln.hasArt of {
True => "die" ++ ln.s ! Weak ! c ;
False => ln.s ! Strong ! c
})
} ;
AdjLN ap ln = ln ** {
s = \\a,c =>
preOrPost ap.isPre
(ap.s ! agrAdj Neutr a (NF ln.n Nom))
(ln.s ! a ! c) ;
} ;
}

View File

@@ -77,6 +77,8 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in {
NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ;
OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ;
NumDecimal dec = {s = \\g,c => dec.s ! NCard g c; n = dec.n } ;
NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ;
OrdNumeral numeral = {s = \\af => numeral.s ! NOrd af} ;
@@ -177,4 +179,10 @@ concrete NounAfr of Noun = CatAfr ** open ResAfr, Prelude in {
isMod = cn.isMod
} ;
QuantityNP n m = {
s = \\c => preOrPost m.isPre m.s (n.s ! NCard Neutr Nom) ;
a = agrP3 n.n ;
isPron = False
} ;
}

View File

@@ -1,5 +1,5 @@
concrete NumeralAfr of Numeral = CatAfr [Numeral,Digits] ** open ResAfr, Prelude in {
concrete NumeralAfr of Numeral = CatAfr [Numeral,Digits,Decimal] ** open ResAfr, Prelude in {
flags optimize = all_subs ;
coding=utf8 ;
@@ -75,6 +75,20 @@ lin
D_8 = mkDig "8" ;
D_9 = mkDig "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = \\o => "-" ++ BIND ++ d.s ! o ;
n = Pl ;
hasDot=False
} ;
IFrac d i = {
s = \\o => d.s ! invNum ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! o;
n = Pl ;
hasDot=True
} ;
oper
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ;

View File

@@ -73,6 +73,25 @@ oper
mkPN : Str -> PN ; -- proper name
} ;
mkGN = overload { -- given name
mkGN : Str -> GN = \s -> lin GN {s = \\_ => s; g = Male} ;
mkGN : Str -> Sex -> GN = \s,g -> lin GN {s = \\_ => s; g = g} ;
} ;
mkSN = overload { -- given name
mkSN : Str -> SN = \s -> lin SN {s = \\_,_ => s; pl = \\_=>s} ;
mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Male=>\\_=>male; Female=>\\_=>female}; pl=\\_=>pl} ;
} ;
mkLN = overload {
mkLN : Str -> LN -- location name
= \s -> lin LN {s = \\_,_ => s; hasArt = False; n = Sg} ;
mkLN : Str -> Number -> LN -- location name
= \s,n -> lin LN {s = \\_,_ => s; hasArt = False; n = n} ;
} ;
defLN : LN -> LN = \n -> n ** {hasArt = True} ;
--2 Adjectives
@@ -205,6 +224,8 @@ oper
feminine = Neutr ;
het,neuter = Neutr ;
de,utrum = Neutr ;
male = Male ;
female = Female ;
mkA = overload {
mkA : (vers : Str) -> A = \a -> lin A (regAdjective a) ;
@@ -494,4 +515,6 @@ oper
--
--}
mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ;
}

View File

@@ -22,6 +22,7 @@ lincat
Prep = ResAmh.Prep;
Numeral = ResAmh.Numeral; --{s : CardOrd => Case => Str ; n : Number} ;
Digits = ResAmh.Digits;--{s : CardOrd => Case => Str ; n : Number ; tail : DTail} ;
Decimal = ResAmh.Decimal;
Ord = ResAmh.Ord ; --{ s : Case => Str } ;
Num = ResAmh.Num;--{s : Case => Str ; n : Number ; hasCard : Bool} ;
Card = ResAmh.Card;--{s : Case => Str ; n : Number} ;

View File

@@ -94,6 +94,7 @@ lin
NumCard n = {s = \\s,c => n.s!Masc!Sg!s!c ; n = Pl; hasCard = True} ;
NumDigits n = {s = n.s ! NCard } ;
NumDecimal n = {s = n.s ! NCard } ;
NumNumeral numeral = {s = numeral.s ! NCard} ;

View File

@@ -1,5 +1,5 @@
concrete NumeralAmh of Numeral = CatAmh [Numeral,Digits] ** open ResAmh,ParamX,Prelude in {
concrete NumeralAmh of Numeral = CatAmh [Numeral,Digits,Decimal] ** open ResAmh,ParamX,Prelude in {
flags coding = utf8;
lincat
@@ -91,6 +91,18 @@ lin pot3plus n m = {
D_8 = mkDig "8" ;
D_9 = mk2Dig "9" "9ኛ";
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = \\o,g,n,s,c => "-" ++ BIND ++ d.s !o!g!n!s!c ;
hasDot=False
} ;
IFrac d i = {
s = \\o,g,n,s,c => d.s!NCard!Masc!Sg!Indef!c ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! o ! g ! n ! s ! c;
hasDot=True
} ;
oper
commaIf : DTail -> Str = \t -> case t of {
T3 => BIND++","++BIND ;

View File

@@ -161,6 +161,10 @@ resource ResAmh = PatternsAmh** open Prelude,MorphoAmh,ParamX in {
s : CardOrd=>Gender=>Number=>Species=>Case => Str ;
tail : DTail
} ;
Decimal = {
s : CardOrd=>Gender=>Number=>Species=>Case => Str ;
hasDot : Bool
} ;
Ord = {s : Gender=>Number=>Species=>Case => Str} ;

View File

@@ -90,6 +90,7 @@ concrete CatGrc of Cat = CommonX - [Temp,Tense] ** open ResGrc, Prelude in {
Numeral = {s : CardOrd => Str ; n : Number} ;
Digits = {s : Str ; unit : Unit} ;
Decimal = {s : Str ; unit : Unit ; hasDot : Bool} ;
-- Structural

View File

@@ -83,6 +83,8 @@ concrete NounGrc of Noun = CatGrc ** open Prelude, ResGrc, (M = MorphoGrc) in {
-- TODO: check the following two:
NumDigits digits = let num : Number = case digits.unit of {one => Sg ; _ => Pl}
in {s = \\g,c => digits.s ++ "'"; n = num ; isCard = True} ;
NumDecimal digits = let num : Number = case digits.unit of {one => Sg ; _ => Pl}
in {s = \\g,c => digits.s ++ "'"; n = num ; isCard = True} ;
NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ;
AdNum adn num = {s = \\g,c => adn.s ++ num.s ! g ! c ; n = num.n} ;

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract:../common:../prelude:
concrete NumeralGrc of Numeral = CatGrc ** open ResGrc, MorphoGrc in {
concrete NumeralGrc of Numeral = CatGrc ** open ResGrc, MorphoGrc, Prelude in {
lincat
Digit = {s : DForm => CardOrd => Str} ;
@@ -81,6 +81,8 @@ lin -- mkDigit d (d+10) (d*10) d-th d-times
D_8 = mkDig "h" "p" "w" ;
D_9 = mkDig "v" "K" "P" ; -- TODO: replace K by koppa, P by sampi (not in ut -ancientgreek)
PosDecimal d = d ** {hasDot=False} ;
oper
TDigit = {
s : Unit => Str

View File

@@ -1,4 +1,4 @@
--# -path=.:alltenses:prelude
--# -path=../abstract:.:alltenses:prelude:
instance SyntaxGer of Syntax = ConstructorsGer, CatGer, StructuralGer, CombinatorsGer ;

View File

@@ -67,6 +67,8 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
n : Size } ;
Digits = {s : Str;
n : Size};
Decimal = {s : Str;
n : Size; hasDot : Bool};
-- Structural

View File

@@ -130,6 +130,10 @@ lin
s = \\_,_,_ => digits.s ;
isNum = True
};
NumDecimal dec = dec ** {
s = \\_,_,_ => dec.s ;
isNum = True
};
NumNumeral numeral = numeral ** {
s = numeral.s ! NCard ;

View File

@@ -1,4 +1,4 @@
concrete NumeralAra of Numeral = CatAra [Numeral,Digits] **
concrete NumeralAra of Numeral = CatAra [Numeral,Digits,Decimal] **
open Predef, Prelude, ResAra, MorphoAra in {
flags coding=utf8 ;
@@ -136,6 +136,20 @@ lincat
D_8 = mk1Dig "8" ;
D_9 = mk1Dig "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = "-" ++ BIND ++ d.s;
n = ThreeTen ;
hasDot=False
} ;
IFrac d i = {
s = d.s ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ;
n = ThreeTen ;
hasDot=True
} ;
oper

View File

@@ -61,7 +61,8 @@ incomplete concrete CatBantu of Cat =
Numeral = {s : CardOrd => Gender => Str ; n : Number} ;
Digits = {s : CardOrd => Gender => Str ; n : Number} ;
Digits = {s : CardOrd => Gender => Str ; n : Number} ;
Decimal = {s : CardOrd => Gender => Str ; n : Number ; hasDot : Bool} ;
-- Structural
@@ -81,7 +82,7 @@ incomplete concrete CatBantu of Cat =
-- N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ;
N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Prep} ;
N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Prep} ;
GN, SN, PN = {s : Case => Str ; g : Gender} ;
GN, SN, LN, PN = {s : Case => Str ; g : Gender} ;
--Tense = {s : Str ; t : ResKam.Tense} ;
linref

View File

@@ -77,6 +77,7 @@ lin
NumCard n = n ;--** {hasCard = True} ;
NumDigits n = {s = n.s ! NCard ; n = n.n} ;
NumDecimal n = {s = n.s ! NCard ; n = n.n} ;
OrdDigits n = { s = n.s ! NOrd} ;
NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ;

View File

@@ -85,6 +85,7 @@ concrete CatEus of Cat = CommonX ** open ResEus, Prelude in {
Numeral = { s : Str ; n : Number } ;
Digits = { s : CardOrd => Str ; n : Number } ;
Decimal = { s : CardOrd => Str ; n : Number ; hasDot : Bool} ;

View File

@@ -125,6 +125,7 @@ concrete NounEus of Noun = CatEus ** open ResEus, Prelude in {
-- : Digits -> Card ;
NumDigits dig = { s = dig.s ! NCard ; n = dig.n } ;
NumDecimal dec = { s = dec.s ! NCard ; n = dec.n } ;
-- : Numeral -> Card ;
NumNumeral num = num ;
@@ -260,4 +261,4 @@ concrete NounEus of Noun = CatEus ** open ResEus, Prelude in {
oper
elative : NP -> Str = \np -> glue (np.s ! LocStem) "rik" ;
}
}

View File

@@ -1,4 +1,4 @@
concrete NumeralEus of Numeral = CatEus [Numeral,Digits] ** open Prelude, ResEus, ParamX in {
concrete NumeralEus of Numeral = CatEus [Numeral,Digits,Decimal] ** open Prelude, ResEus, ParamX in {
oper LinDigit : Type = { s : DForm => Str ;
n : Number ;
@@ -112,5 +112,18 @@ lin D_9 = mkDig "9" ;
lin IDig dig = dig ;
-- : Dig -> Digits -> Digits ;
lin IIDig dig digs = digs ** {s = \\co => glue (dig.s ! co) (digs.s ! co) } ;
lin PosDecimal d = d ** {hasDot=False} ;
lin NegDecimal d = {
s = \\co => glue "-" (d.s ! co) ;
n = Pl ;
hasDot=False
} ;
lin IFrac d i = {
s = \\co => d.s ! co ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! co ;
n = Pl ;
hasDot=False
} ;
}

View File

@@ -64,6 +64,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, (
Numeral = {s : CardOrd => Str; n : Number} ;
Digits = {s : CardOrd => Str; n : Number; tail : DTail} ;
Decimal = {s : CardOrd => Str; n : Number; hasDot : Bool} ;
-- Structural
@@ -88,6 +89,7 @@ concrete CatBul of Cat = CommonX - [IAdv,AdV] ** open ResBul, Prelude, Predef, (
N3 = {s : NForm => Str; rel : AForm => Str; relType : NRelType; g : AGender} ** {c2,c3 : Preposition} ;
GN = {s : Str; g : Sex} ;
SN = {s : Sex => Str; pl : Str} ;
LN = {s : Species => Str; onPrep : Bool; gn : GenNum} ;
PN = {s : Str; gn : GenNum} ;
lindef

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract:../common
concrete DocumentationBul of Documentation = CatBul ** open
ResBul,
ResBul, Prelude,
HTML in {
flags coding=utf8 ;
@@ -92,6 +92,25 @@ lin
s3 = ""
} ;
InflectionLN = \n -> {
t = "същ.с." ;
s1= heading1 ("Име за Място"++
case n.gn of {
GSg Masc => "(м.р.)" ;
GSg Fem => "(ж.р.)" ;
GSg Neut => "(ср.р.)" ;
GPl => "(мн.ч.)"
}) ;
s2 = paragraph (n.s ! Indef) ++
heading1 ("Наречие") ++
paragraph (case n.onPrep of {
True => linCase Dat Pos ;
False => vyv_Str
} ++
n.s ! Def) ;
s3 = ""
} ;
InflectionGN = \gn -> {
t = "същ.с.л." ;
s1= heading1 (case gn.g of {
@@ -145,7 +164,7 @@ lin
} ;
InflectionPrep = \prep -> {
t = "пр" ;
t = "пред" ;
s1= heading1 ("Предлог") ;
s2= paragraph (prep.s) ;
s3= ""

View File

@@ -300,26 +300,10 @@ lin UseDAP dap = {
p = NounP3 dap.p
} ;
lin GivenName = \n -> {
s = n.s ;
gn = GSg (sex2gender n.g)
} ;
lin MaleSurname = \n -> {
s = n.s ! Male ;
gn = GSg Masc
} ;
lin FemaleSurname = \n -> {
s = n.s ! Female;
gn = GSg Fem
} ;
lin PlSurname = \n -> {
s = n.pl ;
gn = GPl
} ;
lin FullName gn sn = {
s = gn.s ++ sn.s ! gn.g ;
gn = GSg (sex2gender gn.g)
} ;
lin UseComp_estar = UseComp ;
UseComp_ser = UseComp ;
lin ProDrop pro = pro ;
lin AnaphPron np =
case <np.gn, np.p> of {

View File

@@ -15,7 +15,8 @@ concrete GrammarBul of Grammar =
TextBul,
StructuralBul,
IdiomBul,
TenseX - [CAdv,IAdv,AdV,SC]
TenseX - [CAdv,IAdv,AdV,SC],
NamesBul
** {
flags coding=utf8 ;

View File

@@ -165,6 +165,7 @@ oper
NF Sg Indef => sg ;
NF Sg Def => case sg of {
_+"а"=>sg+"та" ;
_+"ю"=>sg+"та" ;
_+"я"=>sg+"та" ;
_+"о"=>sg+"то" ;
_+"у"=>sg+"то" ;

View File

@@ -291,6 +291,17 @@ oper
\s,gn -> {s = s; gn = gn ; lock_PN = <>} ;
} ;
mkLN = overload {
mkLN : Str -> LN = \s -> lin LN {s = \\_ => s; onPrep = False; gn = GSg Masc} ;
mkLN : Str -> Gender -> LN =
\s,g -> lin LN {s = \\_ => s; onPrep = False; gn = GSg g} ;
mkLN : Str -> GenNum -> LN =
\s,gn -> lin LN {s = \\_ => s; onPrep = False; gn = gn} ;
mkLN : Str -> Str -> GenNum -> LN =
\s1,s2,gn -> lin LN {s = table Species [s2; s1]; onPrep = False; gn = gn} ;
} ;
onLN : LN -> LN = \n -> n ** {onPrep = True} ;
--2 IAdv
--

62
src/bulgarian/NamesBul.gf Normal file
View File

@@ -0,0 +1,62 @@
concrete NamesBul of Names = CatBul ** open ResBul, Prelude in {
lin GivenName = \n -> {
s = table { RObj c => linCase c Pos ++ n.s;
_ => n.s
} ;
gn = GSg (sex2gender n.g) ;
p = NounP3 Pos
} ;
lin MaleSurname = \n -> {
s = table { RObj c => linCase c Pos ++ n.s ! Male;
_ => n.s ! Male
} ;
gn = GSg Masc ;
p = NounP3 Pos
} ;
lin FemaleSurname = \n -> {
s = table { RObj c => linCase c Pos ++ n.s ! Female;
_ => n.s ! Female
} ;
gn = GSg Fem ;
p = NounP3 Pos
} ;
lin PlSurname = \n -> {
s = table { RObj c => linCase c Pos ++ n.pl ;
_ => n.pl
} ;
gn = GPl ;
p = NounP3 Pos
} ;
lin FullName gn sn = {
s = table { RObj c => linCase c Pos ++ gn.s ++ sn.s ! gn.g ;
_ => gn.s ++ sn.s ! gn.g
} ;
gn = GSg (sex2gender gn.g) ;
p = NounP3 Pos
} ;
lin UseLN, PlainLN = \n -> {
s = table { RObj c => linCase c Pos ++ n.s ! Def ;
_ => n.s ! Def
} ;
gn = n.gn ;
p = NounP3 Pos
} ;
InLN n = {
s = case n.onPrep of {
True => linCase Dat Pos ;
False => vyv_Str
} ++
n.s ! Def
} ;
AdjLN ap n = n ** {
s = \\sp => case ap.isPre of {
True => ap.s ! aform n.gn sp RSubj ! P3 ++ n.s ! Indef ;
False => n.s ! sp ++ ap.s ! aform n.gn sp RSubj ! P3
}
} ;
}

View File

@@ -116,6 +116,7 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in {
NumCard n = {s=n.s; nn=n.nn; nonEmpty = True} ;
NumDigits n = {s = \\gspec => n.s ! NCard gspec; nn = case n.n of {Sg => NNum Sg; Pl => NCountable}} ;
NumDecimal n = {s = \\gspec => n.s ! NCard gspec; nn = case n.n of {Sg => NNum Sg; Pl => NCountable}} ;
OrdDigits n = {s = \\aform => n.s ! NOrd aform} ;
NumNumeral numeral = {s = \\gspec => numeral.s ! NCard gspec; nn = case numeral.n of {Sg => NNum Sg; Pl => NCountable}} ;
@@ -238,4 +239,11 @@ concrete NounBul of Noun = CatBul ** open ResBul, Prelude in {
p = dap.p
} ;
DetDAP det = det ;
QuantityNP n m = {
s = \\role => preOrPost m.isPre m.s (n.s ! NCard (CFMasc Indef NonHuman)) ;
gn = gennum (AMasc NonHuman) n.n ;
p = NounP3 Pos
} ;
}

View File

@@ -1,5 +1,5 @@
--# -coding=utf8
concrete NumeralBul of Numeral = CatBul [Numeral,Digits] ** open Prelude, ResBul in {
concrete NumeralBul of Numeral = CatBul [Numeral,Digits,Decimal] ** open Prelude, ResBul in {
flags coding=utf8 ;
@@ -97,8 +97,11 @@ lin pot3plus n m = {
n = Pl
} ;
lin pot3as4 n = n ;
lin pot3float f = {
s = \\c,nf => f.s ++ mkCardOrd100 "хиляди" "хилядите" "хиляден" ! c ;
lin pot3decimal d = {
s = \\c,nf => case d.n of {
Sg => mkCardOrd100 "хиляда" "хилядата" "хиляден" ! NCard (CFMasc Indef NonHuman) ;
Pl => d.s ! NCard (CFFem Indef) ++ mkCardOrd100 "хиляди" "хилядите" "хиляден" ! c
} ;
n = Pl
} ;
@@ -118,8 +121,17 @@ lin pot4plus n1 n2 = {
n = Pl
} ;
lin pot4as5 n = n ;
lin pot4float f = {
s = \\c,nf => f.s ++ mkCardOrd100 "милиона" "милиона" "милионен" ! c ;
lin pot4decimal d = {
s = \\c,nf => case c of {
NCard (CFMasc s a) => d.s ! NCard (CFMasc s NonHuman) ;
NCard (CFMascDefNom a) => d.s ! NCard (CFMascDefNom NonHuman) ;
NCard cf => d.s ! NCard cf ;
NOrd _ => d.s ! NCard (CFMasc Indef NonHuman)
} ++
case d.n of {
Sg => "милион" ;
Pl => "милиона"
} ;
n = Pl
} ;
@@ -138,8 +150,12 @@ lin pot5plus n1 n2 = {
s = \\o,f => (pot5 n1).s ! o ! f ++ "и" ++ n2.s ! o ! f;
n = Pl
} ;
lin pot5float f = {
s = \\c,nf => f.s ++ mkCardOrd100 "милиярда" "милиярда" "милиярден" ! c ;
lin pot5decimal d = {
s = \\c,nf => d.s ! NCard (CFFem Indef) ++
case d.n of {
Sg => mkCardOrd100 "милиярд" "милиярда" "милиярден" ! c ;
Pl => mkCardOrd100 "милиярди" "милиярдите" "милиярден" ! c
} ;
n = Pl
} ;
@@ -168,6 +184,16 @@ lin pot5float f = {
D_8 = mk3Dig "8" "8на" "8ми" Pl ;
D_9 = mk3Dig "9" "9има" "9ти" Pl ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {s=\\o=>"-" ++ BIND ++ d.s ! o; hasDot=False; n = Pl} ;
IFrac d i = {
s = \\o => d.s ! NCard (CFMasc Indef NonHuman) ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! o;
n = Pl ;
hasDot=True
} ;
oper
spaceIf : DTail -> Str = \t -> case t of {
T3 => SOFT_BIND ;

View File

@@ -2116,4 +2116,7 @@ oper
adjAdv : A -> Str -> A =
\a,adv -> a ** {adv = adv} ;
mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ;
}

View File

@@ -47,7 +47,6 @@ resource ResBul = ParamX ** open Prelude, Predef in {
param
Gender = Masc | Fem | Neut ;
Sex = Male | Female ;
Species = Indef | Def ;
@@ -859,4 +858,9 @@ resource ResBul = ParamX ** open Prelude, Predef in {
Female => Fem
} ;
vyv_Str : Str
= pre { "в" ;
"във" / strs {"в" ; "ф" ; "В" ; "Ф"}
} ;
}

View File

@@ -44,9 +44,7 @@ concrete StructuralBul of Structural = CatBul **
if_Subj = ss "ако" ;
in8front_Prep = mkPrep "пред" ;
i_Pron = mkPron "аз" "мой" "моя" "моят" "моя" "моята" "мое" "моето" "мои" "моите" (GSg Masc) PronP1 ;
in_Prep = mkPrep (pre { "в" ;
"във" / strs {"в" ; "ф" ; "В" ; "Ф"}
}) ;
in_Prep = mkPrep vyv_Str ;
it_Pron = mkPron "то" "негов" "неговия" "неговият" "негова" "неговата" "негово" "неговото" "негови" "неговите" (GSg Neut) PronP3 ;
less_CAdv = X.mkCAdv "по-малко" "от" ;
many_Det = mkDeterminerPl "много" ;

View File

@@ -225,4 +225,7 @@ oper
polNegDirSubj = RPos ;
param
HasArt = NoArt | UseArt ;
}

View File

@@ -40,6 +40,42 @@ lin
)
} ;
InflectionGN = \gn -> {
t = "pn" ;
s1 = heading1 ("Prenom" ++
case gn.g of {
Masc => "("+heading masculine_Parameter+")" ;
Fem => "("+heading feminine_Parameter+")"
}) ;
s2 = gn.s
} ;
InflectionSN = \gn -> {
t = "pn" ;
s1 = heading1 "Família" ;
s2 = gn.s ! Masc
} ;
InflectionPN = \pn -> {
t = "pn" ;
s1 = heading1 ("Nom Propi" ++
case pn.g of {
Masc => "("+heading masculine_Parameter+")" ;
Fem => "("+heading feminine_Parameter+")"
}) ;
s2 = pn.s
} ;
InflectionLN = \ln -> {
t = "nl" ;
s1 = heading1 ("Nom de la Ubicació" ++
case ln.g of {
Masc => "("+heading masculine_Parameter+")" ;
Fem => "("+heading feminine_Parameter+")"
}) ;
s2 = paragraph ln.s
} ;
InflectionA, InflectionA2 = \adj -> {
t = "a" ;
s1 = heading1 (nounHeading adjective_Category).s ;

View File

@@ -15,10 +15,4 @@ concrete ExtendCat of Extend = CatCat ** ExtendRomanceFunctor-- -
ParadigmsCat in {
-- put your own definitions here
lin GivenName, MaleSurname, FemaleSurname = \n -> n ;
lin FullName gn sn = {
s = gn.s ++ sn.s ;
g = gn.g
} ;
} ;

View File

@@ -14,7 +14,8 @@ concrete GrammarCat of Grammar =
TextX - [SC,Temp,Tense,Pol,PPos,PNeg],
IdiomCat,
StructuralCat,
TenseCat
TenseCat,
NamesCat
** {

41
src/catalan/NamesCat.gf Normal file
View File

@@ -0,0 +1,41 @@
concrete NamesCat of Names = CatCat ** open ResCat, CommonRomance, Prelude in {
lin GivenName = \n -> pn2np n ;
lin MaleSurname = \n -> pn2np {s = n.s ! Masc; g = Masc} ;
lin FemaleSurname = \n -> pn2np {s = n.s ! Fem; g = Fem} ;
lin PlSurname = \n -> heavyNPpol False {
s = \\c => prepCase c ++ n.pl ;
a = agrP3 Masc Pl
} ;
lin FullName gn sn = pn2np {
s = gn.s ++ sn.s ! gn.g ;
g = gn.g
} ;
lin PlainLN n = heavyNP {
s = \\c => n.s;
a = {g = n.g ; n = n.num ; p = P3}
} ;
lin UseLN n = heavyNP {
s = \\c => case n.art of {
UseArt => artDef True n.g n.num c ++ n.s ;
_ => n.s
} ;
a = {g = n.g ; n = n.num ; p = P3}
} ;
lin InLN n = {
s = "en" ++ case n.art of {
UseArt => artDef True n.g n.num Acc ++ n.s;
_ => prepCase Acc ++ n.s
} ;
} ;
lin AdjLN ap n = n ** {
s = preOrPost ap.isPre (ap.s ! AF n.g n.num) n.s ;
} ;
}

View File

@@ -1,4 +1,4 @@
concrete NumeralCat of Numeral = CatCat [Numeral,Digits] **
concrete NumeralCat of Numeral = CatCat [Numeral,Digits,Decimal] **
open CommonRomance, ResRomance, MorphoCat, Prelude in {
flags coding=utf8 ;
@@ -158,6 +158,20 @@ param
D_8 = mkDig "8" ;
D_9 = mkDig "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = \\o => "-" ++ BIND ++ d.s ! o ;
n = Pl ;
hasDot=False
} ;
IFrac d i = {
s = \\o => d.s ! NCard Masc ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! o ;
n = Pl ;
hasDot=True
} ;
oper
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":o") ;

View File

@@ -139,6 +139,39 @@ oper
mkPN : N -> PN ;
} ;
mkGN = overload {
mkGN : (Anna : Str) -> GN = \s -> lin GN (regPN s) ; -- feminine for "-a", otherwise masculine
mkGN : (Pilar : Str) -> Gender -> GN = \s,g -> lin GN (mk2PN s g) ; -- force gender
} ;
mkSN = overload {
mkSN : Str -> SN = \s -> lin SN {s = \\_ => s; pl = s} ;
mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Masc=>male; Fem=>female}; pl = pl} ;
} ;
mkLN = overload {
mkLN : Str -> LN = \s ->
lin LN {s = s ;
onPrep=False ;
art = NoArt ;
g = Masc ;
num = Sg} ;
mkLN : Str -> Gender -> LN = \s,g ->
lin LN {s = s ;
onPrep=False ;
art = NoArt ;
g = g ;
num = Sg} ;
mkLN : Str -> Gender -> Number -> LN = \s,g,n ->
lin LN {s = s ;
onPrep=False ;
art = NoArt ;
g = g ;
num = n}
} ;
defLN : LN -> LN = \n -> n ** {art = UseArt} ;
--2 Adjectives
@@ -302,6 +335,8 @@ oper
CopulaType = DiffCat.CopulaType ;
masculine = Masc ;
feminine = Fem ;
male = Masc ;
female = Fem ;
singular = Sg ;
plural = Pl ;
serCopula = DiffCat.serCopula ;
@@ -553,6 +588,6 @@ oper
mk2V2 : V -> Prep -> V2 ;
dirV2 : V -> V2 ;
mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ;
} ;

View File

@@ -5,7 +5,7 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in {
PositA a = a ** {hasAdA = False} ;
ComparA a np = a ** {
s = table {_=> than_s ++ np.s ++ a.s!Attr};
s = table {_=> than_s ++ linNP np ++ a.s!Attr};
hasAdA = False
};
@@ -26,11 +26,11 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in {
};
CAdvAP ad ap np = ap ** {
s = table {adjPlace => ad.s ++ np.s ++ ad.p ++ ap.s!adjPlace}
s = table {adjPlace => ad.s ++ linNP np ++ ad.p ++ ap.s!adjPlace}
};
ComplA2 a np = a ** {
s= table { adjPlace => appPrep a.c2 np.s ++ a.s!adjPlace};
s= table { adjPlace => appPrep a.c2 (linNP np) ++ a.s!adjPlace};
hasAdA = False
};

View File

@@ -4,9 +4,9 @@ concrete AdverbChi of Adverb = CatChi **
lin
PositAdvAdj a = {s = a.s!Attr ++ "地" ; advType = ATManner ; hasDe = False} ; ---- for all adjs?
PrepNP prep np = ss (appPrep prep np.s) ** {advType = prep.advType ; hasDe = prep.hasDe} ; --- should depend on np too ?
PrepNP prep np = ss (appPrep prep (linNP np)) ** {advType = prep.advType ; hasDe = prep.hasDe} ; --- should depend on np too ?
ComparAdvAdj cadv a np = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ np.s) ** {advType = ATManner ; hasDe = False} ;
ComparAdvAdj cadv a np = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ (linNP np)) ** {advType = ATManner ; hasDe = False} ;
ComparAdvAdjS cadv a s = ss (a.s!Attr ++ cadv.s ++ cadv.p ++ linS s) ** {advType = ATManner ; hasDe = False} ;

View File

@@ -43,7 +43,8 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu
-- Noun
CN = ResChi.Noun ;
NP, Pron = ResChi.NP ;
NP = ResChi.NP ;
Pron = SS ;
Det = Determiner ;
Quant = Determiner ** {pl : Str} ;
Predet = {s : Str} ; ----
@@ -56,6 +57,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu
Numeral = {s,p : Str} ;
Card, Digits = {s : Str} ;
Decimal = {s : Str ; hasDot : Bool} ;
-- Structural
@@ -79,7 +81,7 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Ant, Adv] ** open ResChi, Prelu
N = ResChi.Noun ;
N2 = ResChi.Noun ** {c2 : Preposition} ;
N3 = ResChi.Noun ** {c2,c3 : Preposition} ;
GN, SN, PN = ResChi.NP ;
GN, SN, LN, PN = SS ;
-- overridden
@@ -91,4 +93,5 @@ linref
S = linS ;
Prep = linPrep ;
VP = infVP ;
NP = \np -> np.det ++ np.s ;
}

View File

@@ -11,7 +11,7 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin
postJiu = ss.postJiu}
} ;
ConjAdv c as = conjunctDistrSS (c.s ! CSent) as ** {advType = as.advType ; hasDe = as.hasDe} ; ---- ??
ConjNP c = conjunctDistrSS (c.s ! CPhr CNPhrase) ;
ConjNP c nps = conjunctDistrSS (c.s ! CPhr CNPhrase) nps ** {det = []} ;
ConjAP c as = conjunctDistrTable AdjPlace (c.s ! CPhr CAPhrase) as ** {monoSyl = notB as.monoSyl ; hasAdA = True} ; ---- add de iff as doesn't
ConjRS c = conjunctDistrSS (c.s ! CSent) ;
ConjCN c ns = conjunctDistrSS (c.s ! CPhr CNPhrase) ns ** {c = ns.c} ;
@@ -28,8 +28,8 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin
BaseAdv x y = twoSS x y ** {advType = x.advType ; hasDe = y.hasDe} ; ---- ??
ConsAdv x xs = consrSS duncomma x xs ** {advType = x.advType ; hasDe = xs.hasDe} ; ---- ??
BaseNP = twoSS ;
ConsNP = consrSS duncomma ;
BaseNP np1 np2 = twoSS (mergeNP np1) (mergeNP np2) ;
ConsNP np nps = consrSS duncomma (mergeNP np) nps ;
BaseAP x y = twoTable AdjPlace x y ** {monoSyl = y.monoSyl} ;
ConsAP x xs = consrTable AdjPlace duncomma x xs ** {monoSyl = xs.monoSyl} ;
BaseRS = twoSS ;
@@ -46,5 +46,8 @@ concrete ConjunctionChi of Conjunction = CatChi ** open ResChi, Prelude, Coordin
[RS] = {s1,s2 : Str} ;
[CN] = {s1,s2 : Str ; c : Str} ;
oper
mergeNP : ResChi.NP -> SS = \np -> ss (linNP np) ;
}

View File

@@ -1,6 +1,6 @@
--# -path=.:../abstract
concrete ConstructionChi of Construction = CatChi **
concrete ConstructionChi of Construction = CatChi **
open SyntaxChi, ParadigmsChi, (L = LexiconChi), (E = ExtraChi), (G = GrammarChi), (R = ResChi), Prelude in {
flags coding=utf8 ;
@@ -24,9 +24,9 @@ lin
-- some more things
weather_adjCl ap = mkCl (mkVP (lin AP ap)) ;
is_right_VP = mkVP (ParadigmsChi.mkA "对") ;
is_wrong_VP = mkVP (ParadigmsChi.mkA "错") ;
is_right_VP = mkVP (ParadigmsChi.mkA "对") ;
is_wrong_VP = mkVP (ParadigmsChi.mkA "错") ;
n_units_AP card cn a = mkAP (lin AdA (mkUtt (mkNP <lin Card card : Card> (lin CN cn)))) (lin A a) ; ----
@@ -47,8 +47,8 @@ lin
monthYearAdv m y = lin Adv {s = y.s ++ "年" ++ m.s ; advType = timeAdvType ; hasDe = False} ;
dayMonthYearAdv d m y = lin Adv {s = y.s ++ "年" ++ m.s ++ d.s ++ "日" ; advType = timeAdvType ; hasDe = False} ;
intYear i = lin NP i ;
intMonthday i = lin NP i ;
intYear i = lin NP (R.mkNP i.s) ;
intMonthday i = lin NP (R.mkNP i.s) ;
lincat Language = N ;
@@ -74,9 +74,9 @@ lin friday_Weekday = mkN "星期五" ;
lin saturday_Weekday = mkN "星期六" ;
lin sunday_Weekday = mkN "星期日" ;
lin january_Month = mkN "一月" ;
lin february_Month = mkN "二月" ;
lin march_Month = mkN "三月" ;
lin january_Month = mkN "一月" ;
lin february_Month = mkN "二月" ;
lin march_Month = mkN "三月" ;
lin april_Month = mkN "四月" ;
lin may_Month = mkN "五月" ;
lin june_Month = mkN "六月" ;

View File

@@ -111,6 +111,30 @@ lin
s2 = inflVerb verb
} ;
InflectionPN = \n -> {
t = "pn" ;
s1 = heading1 "Proper Name" ;
s2 = n.s
} ;
InflectionLN = \n -> {
t = "pn" ;
s1 = heading1 "Location Name" ;
s2 = n.s
} ;
InflectionGN = \n -> {
t = "pn" ;
s1 = heading1 "Given Name" ;
s2 = n.s
} ;
InflectionSN = \n -> {
t = "pn" ;
s1 = heading1 "Family Name" ;
s2 = n.s
} ;
oper
inflVerb : Verb -> Str = \verb ->
let vtbl = useVerb verb

View File

@@ -11,7 +11,7 @@ concrete ExtendChi of Extend = CatChi **
, MkVPI2, BaseVPI2, ConsVPI2, ConjVPI2, ComplVPI2
, ProDrop, ComplDirectVS, ComplDirectVQ
, PassVPSlash, PassAgentVPSlash
, GerundAdv, GerundNP ]
, GerundAdv, GerundNP, ByVP, ApposNP ]
with (Grammar=GrammarChi) ** open
Prelude
, Coordination
@@ -27,7 +27,7 @@ concrete ExtendChi of Extend = CatChi **
lin
PassVPSlash vps = insertAdv (mkNP passive_s) vps ;
PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep np.s)) (insertAdv (mkNP passive_s) vps) ;
PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep (linNP np))) (insertAdv (mkNP passive_s) vps) ;
MkVPS t p vp = {s = t.s ++ p.s ++ (mkClause [] vp).s ! p.p ! t.t} ;
ConjVPS c = conjunctDistrSS (c.s ! CSent) ;
@@ -35,16 +35,16 @@ concrete ExtendChi of Extend = CatChi **
ConsVPS = consrSS duncomma ;
-- : NP -> VPS -> S ; -- she [has walked and won't sleep]
PredVPS np vps = {preJiu = np.s ; postJiu = vps.s} ;
PredVPS np vps = {preJiu = (linNP np) ; postJiu = vps.s} ;
-- : NP -> VPS -> QS ; -- has she walked
SQuestVPS np vps = {s = \\_ => np.s ++ vps.s ++ question_s} ;
SQuestVPS np vps = {s = \\_ => linNP np ++ vps.s ++ question_s} ;
-- : IP -> VPS -> QS ; -- who has walked
-- QuestVPS ip vps = -- TODO: probably need to change structure of VPS
-- : RP -> VPS -> RS ; -- which won't sleep
RelVPS rp vps = {s = rp.s ! True ++ vps.s} ;
RelVPS rp vps = {s = rp.s ! True ++ vps.s ++ "的"} ;
MkVPI vp = {s = (mkClause [] vp).s ! Pos ! APlain} ;
ConjVPI c = conjunctDistrSS (c.s ! CSent) ;
@@ -68,7 +68,11 @@ concrete ExtendChi of Extend = CatChi **
GerundAdv vp = mkAdv (infVP vp) ;
GerundNP vp = ResChi.mkNP (infVP vp) ;
GenNP np = {s,pl = np.s ++ possessive_s ; detType = DTPoss} ;
ByVP vp =
let adv : Adv = GerundAdv vp
in adv ** {s = adv.s ++ "来" ; advType = ATTime} ;
GenNP np = {s,pl = linNP np ++ possessive_s ; detType = DTPoss} ;
GenRP nu cn = {s = \\_ => cn.s ++ relative_s} ;
ProDrop pron = pron ** {s = []} ;
@@ -79,13 +83,11 @@ concrete ExtendChi of Extend = CatChi **
AdvVP (UseV <lin V vq : V>)
(mkAdv (":" ++ quoted utt.s)) ; -- DEFAULT complement added as Adv in quotes
lin
ApposNP np1 np2 = {s = np1.s ++ np2.s; det = np1.det} ;
oper
mkAdv : Str -> CatChi.Adv ;
mkAdv str = lin Adv {s = str ; advType = ATManner ; hasDe = False} ;
lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ;
lin FullName gn sn = {
s = gn.s ++ sn.s
} ;
};

View File

@@ -11,21 +11,21 @@ concrete ExtraChi of ExtraChiAbs = CatChi **
lin
PassVPSlash vps = insertAdv (mkNP passive_s) vps ;
PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep np.s)) (insertAdv (mkNP passive_s) vps) ;
PassAgentVPSlash vps np = insertAdv (ss (appPrep S.by8agent_Prep (linNP np))) (insertAdv (mkNP passive_s) vps) ;
MkVPS t p vp = {s = t.s ++ p.s ++ (mkClause [] vp).s ! p.p ! t.t} ;
ConjVPS c = conjunctDistrSS (c.s ! CSent) ;
BaseVPS = twoSS ;
ConsVPS = consrSS duncomma ;
PredVPS np vps = {preJiu = np.s ; postJiu = vps.s} ;
PredVPS np vps = {preJiu = (linNP np) ; postJiu = vps.s} ;
MkVPI vp = {s = (mkClause [] vp).s ! Pos ! APlain} ; --- ?? almost just a copy of VPS
ConjVPI c = conjunctDistrSS (c.s ! CSent) ;
BaseVPI = twoSS ;
ConsVPI = consrSS duncomma ;
GenNP np = {s,pl = np.s ++ possessive_s ; detType = DTPoss} ;
GenNP np = {s,pl = linNP np ++ possessive_s ; detType = DTPoss} ;
GenRP nu cn = {s = \\_ => cn.s ++ relative_s} ; ---- ??

View File

@@ -14,7 +14,8 @@ concrete GrammarChi of Grammar =
TextChi,
StructuralChi,
IdiomChi,
TenseChi
TenseChi,
NamesChi
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -10,11 +10,11 @@ concrete IdiomChi of Idiom = CatChi ** open Prelude, ResChi in {
-- GenericCl vp = mkClause "有人" vp ; (meaning: there is a person)
---- it is John who did it
CleftNP np rs = mkClause rs.s copula np.s ; -- did it + de + is I
CleftNP np rs = mkClause rs.s copula (linNP np) ; -- did it + de + is I
CleftAdv ad s = mkClause (linS s ++ possessive_s) copula ad.s ; -- she sleeps + de + is here
ExistNP np = mkClause [] (regVerb you_s) np.s ; ---- infl of you
ExistNP np = mkClause [] (regVerb you_s) (linNP np) ; ---- infl of you
ExistIP ip = {s = \\_ => (mkClause [] (regVerb you_s) ip.s).s} ; ---- infl of you
@@ -30,7 +30,7 @@ concrete IdiomChi of Idiom = CatChi ** open Prelude, ResChi in {
SelfAdvVP vp = insertAdv (ss reflPron) vp ;
SelfAdVVP vp = insertAdv (ss reflPron) vp ;
SelfNP np = {s = np.s ++ reflPron} ;
SelfNP np = np ** {s = linNP np ++ reflPron} ;
}

15
src/chinese/NamesChi.gf Normal file
View File

@@ -0,0 +1,15 @@
concrete NamesChi of Names = CatChi ** open ResChi, ParadigmsChi, Prelude in {
lin GivenName, MaleSurname, FemaleSurname, PlSurname = \n -> n ** {det = []} ;
lin FullName gn sn = {
s = gn.s ++ sn.s ;
det = []
} ;
lin UseLN ln = ln ** {det = []} ;
lin InLN ln =
let prep : Prep = mkPrep "里" []
in ss (appPrep prep (linNP (ln ** {det = []}))) ** {advType = prep.advType ; hasDe = prep.hasDe} ; --- should depend on np too ?
}

View File

@@ -1,28 +1,33 @@
concrete NounChi of Noun = CatChi ** open ResChi, Prelude in {
lin
DetCN det cn = case det.detType of {
DTFull Sg => {s = det.s ++ cn.c ++ cn.s} ; -- this house
DTFull Pl => {s = det.s ++ xie_s ++ cn.s} ; -- these houses
DTNum => {s = det.s ++ cn.c ++ cn.s} ; -- (these) five houses
DTPoss => {s = det.s ++ cn.s} -- our (five) houses
} ;
UsePN pn = pn ;
UsePron p = p ;
DetCN det cn = cn ** {
det = case det.detType of {
DTFull Sg => det.s ++ cn.c ; -- this house
DTFull Pl => det.s ++ xie_s ; -- these houses
DTNum => det.s ++ cn.c ; -- (these) five houses
DTPoss => det.s -- our (five) houses
}
} ;
DetNP det = {s = case det.detType of {
UsePN pn = pn ** {det = []} ;
UsePron p = p ** {det = []} ;
DetNP det = {
s = [] ;
det = case det.detType of {
DTFull Pl => det.s ++ xie_s ;
DTPoss => det.s ;
_ => det.s ++ ge_s
} ;
} ; ----
} ; ----
PredetNP pred np = mkNP (pred.s ++ np.s) ; ---- possessive_s ++ np.s) ;
PredetNP pred np = np ** {s = pred.s ++ np.s} ; ---- possessive_s ++ np.s) ;
PPartNP np v2 = mkNP ((predV v2 v2.part).verb.s ++ possessive_s ++ np.s) ; ---- ??
PPartNP np v2 = np ** {s = (predV v2 v2.part).verb.s ++ possessive_s ++ np.s} ; ---- ??
AdvNP np adv = mkNP (adv.s ++ possessiveIf adv.hasDe ++ np.s) ;
ExtAdvNP np adv = mkNP (adv.s ++ possessiveIf adv.hasDe ++ embedInCommas np.s) ; ---- commas?
AdvNP np adv = np ** {s = adv.s ++ possessiveIf adv.hasDe ++ np.s} ;
ExtAdvNP np adv = np ** {s = adv.s ++ possessiveIf adv.hasDe ++ embedInCommas np.s} ; ---- commas?
DetQuant quant num = {
s = case num.numType of {
@@ -57,6 +62,7 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in {
NumCard n = n ** {numType = NTFull} ;
NumDigits d = d ** {numType = NTFull} ;
NumDecimal d = d ** {numType = NTFull} ;
OrdDigits d = {s = ordinal_s ++ d.s} ;
NumNumeral numeral = {s = numeral.p} ; -- liang instead of yi
@@ -70,15 +76,15 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in {
DefArt = mkQuant [] [] DTPoss ; -- use that_Quant if you want the_s
IndefArt = mkQuant yi_s [] DTNum ; -- (DTFull Sg) ; -- empty in the plural
MassNP cn = cn ;
MassNP cn = mkNP cn.s ;
UseN n = n ;
UseN2 n = n ;
Use2N3 f = {s = f.s ; c = f.c ; c2 = f.c2} ;
Use3N3 f = {s = f.s ; c = f.c ; c2 = f.c3} ;
ComplN2 f x = {s = appPrep f.c2 x.s ++ f.s ; c = f.c} ;
ComplN3 f x = {s = appPrep f.c2 x.s ++ f.s ; c = f.c ; c2 = f.c3} ;
ComplN2 f x = {s = appPrep f.c2 (linNP x) ++ f.s ; c = f.c} ;
ComplN3 f x = {s = appPrep f.c2 (linNP x) ++ f.s ; c = f.c ; c2 = f.c3} ;
AdjCN ap cn = case ap.monoSyl of {
True => {s = ap.s ! Attr ++ cn.s ; c = cn.c} ;
@@ -88,13 +94,13 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in {
RelCN cn rs = {s = rs.s ++ cn.s ; c = cn.c} ;
AdvCN cn ad = {s = ad.s ++ possessiveIf ad.hasDe ++ cn.s ; c = cn.c} ;
SentCN cn cs = {s = cs.s ++ cn.s ; c = cn.c} ;
ApposCN cn np = {s = np.s ++ cn.s ; c = cn.c} ;
ApposCN cn np = {s = linNP np ++ cn.s ; c = cn.c} ;
RelNP np rs = mkNP (rs.s ++ np.s) ;
RelNP np rs = np ** {s = rs.s ++ np.s} ;
PossNP cn np = {s = np.s ++ possessive_s ++ cn.s ; c = cn.c} ;
PartNP cn np = {s = np.s ++ possessive_s ++ cn.s ; c = cn.c} ;
PossNP cn np = {s = linNP np ++ possessive_s ++ cn.s ; c = cn.c} ;
PartNP cn np = {s = linNP np ++ possessive_s ++ cn.s ; c = cn.c} ;
CountNP det np = {s = det.s ++ ge_s ++ possessive_s ++ np.s} ; --- classifier from NP?
CountNP det np = np ** {det = det.s ++ ge_s ++ possessive_s ++ np.det} ; --- classifier from NP?
}

View File

@@ -1,4 +1,4 @@
concrete NumeralChi of Numeral = CatChi [Numeral,Digits] ** open ResChi, Prelude in {
concrete NumeralChi of Numeral = CatChi [Numeral,Digits,Decimal] ** open ResChi, Prelude in {
flags coding = utf8 ;
@@ -162,4 +162,16 @@ lin pot4as5 n = n ;
D_8 = ss "8" ;
D_9 = ss "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = "-" ++ BIND ++ d.s ;
hasDot=False
} ;
IFrac d i = {
s=d.s ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s;
hasDot=True
} ;
}

View File

@@ -184,7 +184,7 @@ oper
emptyPrep : Preposition = mkPrep [] ;
mkpNP : Str -> CatChi.NP
= \s -> lin NP {s = word s} ;
= \s -> lin NP {s = word s ; det = []} ;
mkAdV : Str -> AdV
= \s -> lin AdV {s = word s} ;
mkAdN : Str -> AdN
@@ -215,6 +215,8 @@ oper
= \s -> lin RP {s = table {True => [] ; False => word s}} ;
mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ;
--. auxiliary
oper

View File

@@ -11,7 +11,7 @@ concrete PhraseChi of Phrase = CatChi ** open Prelude, ResChi in {
UttIP ip = ip ;
UttIAdv iadv = iadv ;
UttNP np = np ;
UttNP np = ss (linNP np) ;
UttCN cn = cn ;
UttAP ap = {s = ap.s!Attr} ;
UttCard x = x ;
@@ -23,6 +23,6 @@ concrete PhraseChi of Phrase = CatChi ** open Prelude, ResChi in {
PConjConj conj = ss (conj.s ! CSent).s2 ;
NoVoc = {s = []} ;
VocNP np = {s = np.s ++ chcomma} ; ---- ??
VocNP np = {s = linNP np ++ chcomma} ; ---- ??
}

View File

@@ -14,11 +14,11 @@ concrete QuestionChi of Question = CatChi **
s = \\_,p,a => ip.s ++ vp.prePart ++ useVerb vp.verb ! p ! a ++ vp.compl
} ;
QuestSlash ip cls = {s = \\_ => (mkClauseCompl cls.np (insertObj (ss (appPrep cls.c2 ip.s)) cls.vp) []).s} ;
QuestSlash ip cls = {s = \\_ => (mkClauseCompl cls.np (insertObj (mkNP (appPrep cls.c2 ip.s)) cls.vp) []).s} ;
QuestIAdv iadv cl = {s = \\_ => (mkClauseCompl cl.np (insertAdv iadv cl.vp) []).s} ;
QuestIComp icomp np = {s = \\_,p,a => np.s ++ icomp.s} ; ---- order
QuestIComp icomp np = {s = \\_,p,a => linNP np ++ icomp.s} ; ---- order
PrepIP p ip = ss (appPrep p ip.s) ;

View File

@@ -9,7 +9,7 @@ concrete RelativeChi of Relative = CatChi ** open ResChi, Prelude in {
} ;
} ; ---- ??
RelSlash rp slash = {s = \\p,a => slash.s ! p ! a ++ appPrep slash.c2 (rp.s ! False)} ;
FunRP p np rp = {s = \\a => appPrep p np.s ++ rp.s ! a} ; ---- ??
FunRP p np rp = {s = \\a => appPrep p (linNP np) ++ rp.s ! a} ; ---- ??
IdRP = {s = table {True => [] ; False => relative_s}} ;
}

View File

@@ -112,7 +112,8 @@ oper
isAdj : Bool ; -- whether it is an adjectival predication and behaves differently in relative
} ;
NP = {s : Str} ;
NP = {det,s : Str} ; -- keep Det separate, because RelNP may put in a RS and that goes before the Det
linNP : NP -> Str = \np -> np.det ++ np.s ;
-- for morphology
@@ -192,11 +193,11 @@ oper
} ;
insertObj : NP -> VP -> VP = \np,vp -> vp ** {
compl = np.s ++ vp.compl ;
compl = linNP np ++ vp.compl ;
} ;
insertObjPost : NP -> VP -> VP = \np,vp -> vp ** {
compl = vp.compl ++ np.s ;
compl = vp.compl ++ linNP np ;
} ;
insertAdv : SS -> VP -> VP = \adv,vp -> vp ** {
@@ -215,7 +216,7 @@ oper
} ;
insertExtra : SS -> VP -> VP = \ext,vp ->
insertObjPost ext vp ;
insertObjPost (mkNP ext.s) vp ;
-- clauses: keep np and vp separate to enable insertion of IAdv
@@ -250,7 +251,7 @@ oper
mkClauseCompl : Str -> VP -> Str -> Clause = \np,vp,compl -> {
s = \\p,a => vp.topic ++ np ++ vp.prePart ++ useVerb vp.verb ! p ! a ++ vp.compl ++ compl ;
np = vp.topic ++ np ;
vp = insertObj (ss compl) vp ;
vp = insertObj (mkNP compl) vp ;
postJiu = \\p,a => vp.prePart ++ useVerb vp.verb ! p ! a ++ vp.compl ++ compl ;
} ;
@@ -278,7 +279,8 @@ oper
} ;
pronNP : (s : Str) -> NP = \s -> {
s = word s
s = word s ;
det = []
} ;
Preposition = {prepPre : Str ; prepPost : Str ; advType : AdvType ; hasDe : Bool} ;
@@ -316,7 +318,7 @@ oper
-- added by AR
mkNP : Str -> NP = ss ; -- not to be used in lexicon building
mkNP : Str -> NP = \s -> {s = s ; det = []} ; -- not to be used in lexicon building
appPrep : Preposition -> Str -> Str = \prep,s ->
prep.prepPre ++ s ++ prep.prepPost ;

View File

@@ -5,7 +5,7 @@ concrete SentenceChi of Sentence = CatChi **
lin
PredVP np vp = mkClause np.s vp ;
PredVP np vp = mkClause (linNP np) vp ;
PredSCVP sc vp = mkClause sc.s vp ;
@@ -17,10 +17,10 @@ concrete SentenceChi of Sentence = CatChi **
} ;
SlashVP np vp =
mkClauseCompl np.s vp []
mkClauseCompl (linNP np) vp []
** {c2 = vp.c2} ;
SlashVS np vs sslash = <mkClause np.s vs sslash.s : Clause> ** {c2 = sslash.c2} ;
SlashVS np vs sslash = <mkClause (linNP np) vs sslash.s : Clause> ** {c2 = sslash.c2} ;
-- yet another reason for discontinuity of clauses

View File

@@ -142,8 +142,8 @@ either7or_DConj = {s = table { -- modified by chenpeng 11.19
conjType = NotJiu ;
} ;
everybody_NP = ssword "每个人" ; -- [mark] "每个人": 每(every)+个(classifier)+人(person)
everything_NP = ssword "每件事" ; -- [mark] "每件事": 每(every)+件(classifier)+事(thing)
everybody_NP = mkNP (ssword "每个人").s ; -- [mark] "每个人": 每(every)+个(classifier)+人(person)
everything_NP = mkNP (ssword "每件事").s ; -- [mark] "每件事": 每(every)+件(classifier)+事(thing)
everywhere_Adv = mkAdv "到处" ;
here7from_Adv = mkAdv "从这里" ; -- from here
here7to_Adv = mkAdv "到这里" ; -- to here
@@ -161,13 +161,13 @@ if_then_Conj = {s = table { -- added by chenpeng 11.19
} ;
conjType = Jiu ;
} ;
nobody_NP = ssword "没人" ;
nothing_NP = ssword "没有什么" ;
nobody_NP = mkNP (ssword "没人").s ;
nothing_NP = mkNP (ssword "没有什么").s ;
on_Prep = mkPrep "在" "上" ;
only_Predet = ssword "只有" ; -- only John
so_AdA = ssword "如此" ;
somebody_NP = ssword "某人" ;
something_NP = ssword "某事" ; -- [mark] in sent, it depends on the context
somebody_NP = mkNP (ssword "某人").s ;
something_NP = mkNP (ssword "某事").s ; -- [mark] in sent, it depends on the context
somewhere_Adv = mkAdv "某处" ;
that_Subj = mkSubj [] chcomma ; -- that + S [mark] comma
there7from_Adv = mkAdv "从那里" ; -- from there

View File

@@ -11,12 +11,12 @@ concrete SymbolChi of Symbol = CatChi ** open Prelude, ResChi in {
NumPN i = i ;
CNIntNP cn i = {
s = cn.s ++ i.s ;
c = cn.c
det = cn.c
} ;
CNSymbNP det cn xs = ss (det.s ++ cn.s ++ xs.s) ; ----
CNSymbNP det cn xs = {det = det.s ; s = cn.s ++ xs.s} ; ----
CNNumNP cn i = {
s = cn.s ++ i.s ;
c = cn.c
det = cn.c
} ;
SymbS sy = simpleS sy.s ;

View File

@@ -7,14 +7,14 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in {
SlashV2a v = predV v v.part ** {c2 = v.c2 ; isPre = v.hasPrep} ;
Slash2V3 v np = insertAdv (mkNP (ba_s ++ np.s)) (predV v v.part) ** {c2 = v.c3 ; isPre = v.hasPrep} ; -- slot for third argument
Slash3V3 v np = insertObj (mkNP (appPrep v.c3 np.s)) (predV v v.part) ** {c2 = v.c2 ; isPre = True} ; -- slot for ba object
Slash2V3 v np = insertAdv (mkNP (ba_s ++ linNP np)) (predV v v.part) ** {c2 = v.c3 ; isPre = v.hasPrep} ; -- slot for third argument
Slash3V3 v np = insertObj (mkNP (appPrep v.c3 (linNP np))) (predV v v.part) ** {c2 = v.c2 ; isPre = True} ; -- slot for ba object
SlashV2A v ap = insertObj {s = ap.s ! Pred} (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
SlashV2A v ap = insertObj (mkNP (ap.s ! Pred)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
SlashV2V v vp = insertObj (mkNP (infVP vp)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
SlashV2S v s = insertObj (ss (say_s ++ linS s)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
SlashV2Q v q = insertObj (ss (say_s ++ q.s ! False)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
SlashV2S v s = insertObj (mkNP (say_s ++ linS s)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
SlashV2Q v q = insertObj (mkNP (say_s ++ q.s ! False)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
ComplVV v vp = {
verb = v ;
@@ -23,14 +23,14 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in {
isAdj = False ;
} ;
ComplVS v s = insertObj (ss (linS s)) (predV v []) ;
ComplVQ v q = insertObj (ss (q.s ! False)) (predV v []) ;
ComplVA v ap = insertObj {s = ap.s ! Pred} (predV v []) ;
ComplVS v s = insertObj (mkNP (linS s)) (predV v []) ;
ComplVQ v q = insertObj (mkNP (q.s ! False)) (predV v []) ;
ComplVA v ap = insertObj (mkNP (ap.s ! Pred)) (predV v []) ;
ComplSlash vp np = case vp.isPre of {
--- True => insertAdv (mkNP (ba_s ++ np.s)) vp ; --- ba or vp.c2 ?
True => insertPP (mkNP (appPrep vp.c2 np.s)) vp ; --- ba or vp.c2 ?
False => insertObj (mkNP (appPrep vp.c2 np.s)) vp
True => insertPP (mkNP (appPrep vp.c2 (linNP np))) vp ; --- ba or vp.c2 ?
False => insertObj (mkNP (appPrep vp.c2 (linNP np))) vp
} ;
UseComp comp = comp ;
@@ -44,13 +44,13 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in {
(insertObj (mkNP (infVP vp)) (predV v v.part)) ** {c2 = vp.c2 ; isPre = vp.isPre} ;
AdvVP vp adv = case adv.advType of {
ATManner => insertObj (ss (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well*
ATManner => insertObj (mkNP (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well*
ATPlace True => insertAdvPost adv vp ; -- he today *in the house* sleeps
ATPlace False => insertAdvPost (ss (zai_V.s ++ adv.s)) vp ; -- he today *here* sleeps
ATTime | ATPoss => insertTopic adv vp -- *today* he here sleeps
} ;
ExtAdvVP vp adv = case adv.advType of { ---- ExtAdvVP also ?
ATManner => insertObj (ss (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well*
ATManner => insertObj (mkNP (deVAdv_s ++ adv.s)) vp ; -- he sleeps *well*
ATPlace True => insertAdvPost adv vp ; -- he today *in the house* sleeps
ATPlace False => insertAdvPost (ss (zai_V.s ++ adv.s)) vp ; -- he today *here* sleeps
ATTime | ATPoss => insertTopic adv vp -- *today* he here sleeps
@@ -73,17 +73,17 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in {
CompNP np = insertObj np (predV copula []) ; ----
CompCN cn = insertObj cn (predV copula []) ; ----
CompCN cn = insertObj (mkNP cn.s) (predV copula []) ; ----
CompAdv adv = case adv.advType of {
ATPlace True => insertObj adv (predV noVerb []) ;
_ => insertObj adv (predV zai_V []) ---- for all others ??
ATPlace True => insertObj (mkNP adv.s) (predV noVerb []) ;
_ => insertObj (mkNP adv.s) (predV zai_V []) ---- for all others ??
} ;
VPSlashPrep vp prep = vp ** {c2 = prep ; isPre = True} ;
AdvVPSlash vp adv = case adv.advType of {
ATManner => insertObj (ss (deVAdv_s ++ adv.s)) vp ; -- he sleeps well
ATManner => insertObj (mkNP (deVAdv_s ++ adv.s)) vp ; -- he sleeps well
ATPlace True => insertAdv adv vp ; -- he sleeps on the table
_ => insertAdv (ss (zai_V.s ++ adv.s)) vp -- he sleeps in the house / today
} ** {c2 = vp.c2 ; isPre = vp.isPre} ;

View File

@@ -160,4 +160,16 @@ lin pot3plus n m =
D_8 = ss "8" ;
D_9 = ss "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = "-" ++ BIND ++ d.s ;
hasDot=False
} ;
IFrac d i = {
s=d.s ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s;
hasDot=True
} ;
}

View File

@@ -1,4 +1,4 @@
concrete CommonX of Common = open (R = ParamX) in {
concrete CommonX of Common = open (R = ParamX), Prelude in {
lincat
Text = {s : Str} ;
@@ -20,4 +20,6 @@ concrete CommonX of Common = open (R = ParamX) in {
Ant = {s : Str ; a : R.Anteriority} ;
Pol = {s : Str ; p : R.Polarity} ;
MU = {s : Str ; isPre : Bool} ;
}

View File

@@ -22,9 +22,11 @@ lin
GenModNP num np cn = DetCN (DetQuant DefArt num) (AdvCN cn (PrepNP possess_Prep np)) ; -- this man's car(s) ; DEFAULT the car of this man
GenModIP = variants {} ; -- Num -> IP -> CN -> IP ; -- whose car(s)
CompBareCN cn = CompCN cn ; -- (is) teacher ; DEFAULT is a teacher
StrandQuestSlash = QuestSlash ; -- whom does John live with ; DEFAULT with whom does John live
StrandRelSlash = RelSlash ; -- that he lives in ; DEFAULT in which he lives
EmptyRelSlash = RelSlash IdRP ; -- he lives in ; DEFAULT in which he lives
StrandQuestSlash = QuestSlash ; -- whom does John live with (default in Eng)
StrandRelSlash = RelSlash ; -- that he lives in (standard in Eng)
PiedPipingQuestSlash = QuestSlash ; -- with whom does John live (default in most languages)
PiedPipingRelSlash = RelSlash ; -- in which he lives (default in most languages)
EmptyRelSlash = RelSlash IdRP ; -- he lives in ; that he lives in
MkVPS vp = variants {} ; -- Temp -> Pol -> VP -> VPS ; -- hasn't slept
ConjVPS = variants {} ; -- Conj -> [VPS] -> VPS ; -- has walked and won't sleep
PredVPS = variants {} ; -- NP -> VPS -> S ; -- has walked and won't sleep
@@ -136,6 +138,10 @@ lin
lincat
X = {s : Str} ;
lin
UseComp_estar = UseComp ;
UseComp_ser = UseComp ;
lin
CardCNCard = variants {} ;

View File

@@ -18,6 +18,9 @@ resource ParamX = open Prelude in {
| Cond --# notpresent
;
param
Sex = Male | Female ;
param
Polarity = Pos | Neg ;

View File

@@ -68,5 +68,6 @@ concrete CatHrv of Cat =
lincat Numeral = {s : AdjForms ; size : NumSize} ;
lincat Digits = {s : Str ; size : NumSize} ;
lincat Decimal = {s : Str ; size : NumSize ; hasDot : Bool} ;
}

View File

@@ -26,6 +26,8 @@ concrete ExtendHrv of Extend = CatHrv **
,ComplBareVS
,CompIQuant
,CompBareCN
,PiedPipingQuestSlash
,PiedPipingRelSlash
]
with (Grammar = GrammarHrv)
**

View File

@@ -89,6 +89,7 @@ lin
NumCard c = c ;
NumDigits ds = ds ** {s = \\_,_ => ds.s} ;
NumDecimal dec = dec ** {s = \\_,_ => dec.s} ;
NumNumeral nu = {
s = \\g,c => (adjFormsAdjective nu.s).s ! g ! Sg ! c ; ---- TODO Sg?
size = nu.size

View File

@@ -1,6 +1,6 @@
concrete NumeralHrv of Numeral =
CatHrv [Numeral, Digits] **
CatHrv [Numeral, Digits, Decimal] **
open
ResHrv,
@@ -125,6 +125,20 @@ oper mkThousand : Str -> NumSize -> Str = \attr,size ->
IIDig d dd = {s = d.s ++ Predef.BIND ++ dd.s ; size = dd.size} ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = "-" ++ Predef.BIND ++ d.s ;
size = d.size ;
hasDot=False
} ;
IFrac d i = {
s = d.s ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s;
size = d.size ;
hasDot=True
} ;
D_0 = { s = "0" ; size = NS_1} ; ---- ??
D_1 = { s = "1" ; size = NS_1} ;
D_2 = { s = "2" ; size = NS_2_4} ;

View File

@@ -66,6 +66,7 @@ concrete CatCze of Cat =
lincat Numeral = Determiner ; ---- TODO: should contain Ord as well
lincat Digits = {s:Str ; size : NumSize} ;
lincat Decimal = {s:Str ; size : NumSize ; hasDot : Bool} ;
}

View File

@@ -25,6 +25,8 @@ concrete ExtendCze of Extend = CatCze **
,ComplBareVS
,CompIQuant
,CompBareCN
,PiedPipingQuestSlash
,PiedPipingRelSlash
]
with (Grammar = GrammarCze)
**
@@ -35,4 +37,4 @@ in {
lin ReflPossPron = justDemPronFormsAdjective reflPossessivePron ;
}
}

View File

@@ -96,6 +96,7 @@ lin
NumCard c = c ;
NumDigits ds = ds ** {s = \\_,_ => ds.s} ;
NumDecimal ds = ds ** {s = \\_,_ => ds.s} ;
NumNumeral nu = nu ;

View File

@@ -1,6 +1,6 @@
concrete NumeralCze of Numeral =
CatCze [Numeral,Digits] **
CatCze [Numeral,Digits,Decimal] **
open
ResCze,
@@ -117,4 +117,18 @@ oper determinerStr : Determiner -> Str = \d -> d.s ! Masc Anim ! Nom ;
D_8 = { s = "8" ; size = Num5} ;
D_9 = { s = "9" ; size = Num5} ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = "-" ++ Predef.BIND ++ d.s ;
size = Num5 ;
hasDot=False
} ;
IFrac d i = {
s = d.s ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ;
size = Num5 ;
hasDot=True
} ;
}

View File

@@ -1,4 +1,4 @@
concrete NumeralDan of Numeral = CatDan [Numeral,Digits] ** open MorphoDan,Prelude in {
concrete NumeralDan of Numeral = CatDan [Numeral,Digits,Decimal] ** open MorphoDan,Prelude in {
flags coding=utf8 ;
@@ -67,6 +67,20 @@ lin n9 = mkTal "ni" "nitten" "halvfems" "niende" "halvfemsindstyvende" ;
D_8 = mkDig "8" ;
D_9 = mkDig "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = \\o => "-" ++ BIND ++ d.s ! o ;
n = Pl ;
hasDot=False
} ;
IFrac d i = {
s=\\o=>d.s ! NCard neutrum ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! o;
hasDot=True;
n = Pl
} ;
oper
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
mkDig : Str -> TDigit = \c -> mk2Dig c (c + ":e") ;

View File

@@ -59,6 +59,7 @@ concrete CatDut of Cat =
Numeral = {s : CardOrd => Str ; n : Number } ;
Digits = {s : CardOrd => Str ; n : Number } ;
Decimal = {s : CardOrd => Str ; n : Number ; hasDot : Bool} ;
-- Structural
@@ -81,6 +82,9 @@ concrete CatDut of Cat =
N = Noun ;
N2 = {s : NForm => Str ; g : Gender} ** {c2 : Preposition} ;
N3 = {s : NForm => Str ; g : Gender} ** {c2,c3 : Preposition} ;
GN, SN, PN = {s : NPCase => Str} ;
PN = {s : NPCase => Str} ;
GN = {s : NPCase => Str; g : Sex} ;
SN = {s : Sex => NPCase => Str; pl : NPCase => Str} ;
LN = {s : Adjf => NPCase => Str ; hasArt : Bool ; n : Number} ;
}

View File

@@ -36,6 +36,30 @@ lin
)
} ;
InflectionPN = \pn -> {
t = "pn" ;
s1 = heading1 "Naam" ;
s2 = paragraph (pn.s ! NPNom)
} ;
InflectionLN = \ln -> {
t = "pn" ;
s1 = heading1 "Naam" ;
s2 = paragraph (ln.s ! Strong ! NPNom)
} ;
InflectionGN = \pn -> {
t = "vnm" ;
s1 = heading1 "Voornaam" ;
s2 = paragraph (pn.s ! NPNom)
} ;
InflectionSN = \pn -> {
t = "van" ;
s1 = heading1 "Van" ;
s2 = paragraph (pn.s ! Male ! NPNom)
} ;
InflectionA, InflectionA2 = \adj ->
let
gforms : AForm -> Str = \a ->
@@ -61,7 +85,7 @@ lin
InflectionAdv, InflectionAdV, InflectionAdA, InflectionAdN = \adv -> {
t = "adv" ;
s1 = heading1 (heading preposition_Category) ;
s1 = heading1 "Bijwoord" ;
s2 = paragraph adv.s
} ;

View File

@@ -5,7 +5,8 @@ concrete ExtendDut of Extend =
- [PastPartAP,ICompAP,IAdvAdv,
VPS,
BaseVPS, ConsVPS,
MkVPS, ConjVPS, PredVPS
MkVPS, ConjVPS, PredVPS,
PassVPSlash, PassAgentVPSlash
]
with
(Grammar = GrammarDut) **
@@ -102,6 +103,11 @@ lin
IAdvAdv adv = {s = "hoe" ++ adv.s} ;
lin PassVPSlash vps =
insertInf (vps.s.s ! VPerf APred) (predV ResDut.worden_V) ;
PassAgentVPSlash vps np =
insertAdv (appPrep (mkPrep "door") np) (insertInf (vps.s.s ! VPerf APred) (predV ResDut.worden_V)) ;
lin
UseDAP dap = dap ** {
s = \\_ => dap.sp ! Neutr ;
@@ -115,9 +121,4 @@ lin
isPron = False
} ;
lin GivenName, MaleSurname, FemaleSurname = \n -> n ;
lin FullName gn sn = {
s = \\c => gn.s ! NPNom ++ sn.s ! c
} ;
}

View File

@@ -14,4 +14,5 @@ concrete GrammarDut of Grammar =
TextX,
IdiomDut,
StructuralDut,
TenseX ;
TenseX,
NamesDut ;

43
src/dutch/NamesDut.gf Normal file
View File

@@ -0,0 +1,43 @@
concrete NamesDut of Names = CatDut ** open Prelude, ResDut in {
lin GivenName = \n -> noMerge ** {s = n.s ; a = agrP3 Sg ; isPron = False} ;
lin MaleSurname = \n -> noMerge ** {s = n.s ! Male ; a = agrP3 Sg ; isPron = False} ;
lin FemaleSurname = \n -> noMerge ** {s = n.s ! Female; a = agrP3 Sg ; isPron = False} ;
lin PlSurname = \n -> noMerge ** {s = n.pl ; a = agrP3 Sg ; isPron = False} ;
lin FullName gn sn =
noMerge ** {s = \\c => gn.s ! NPNom ++ sn.s ! gn.g ! c ; a = agrP3 Sg ; isPron = False} ;
lin UseLN ln = noMerge ** {
s = \\c => case ln.hasArt of {
True => "de" ++ ln.s ! Weak ! c ;
False => ln.s ! Strong ! c
} ;
a = agrP3 ln.n ;
isPron = False
} ;
lin PlainLN ln = noMerge ** {
s = \\c => ln.s ! Strong ! c ;
a = agrP3 ln.n ;
isPron = False
} ;
lin InLN ln = {
s = "in" ++ case ln.hasArt of {
True => "de" ++ ln.s ! Weak ! NPAcc ;
False => ln.s ! Strong ! NPAcc
}
} ;
lin AdjLN ap ln = ln ** {
s = \\a,c =>
let gan : Gender*Adjf*NForm = case ap.isPre of {
True => <Utr,a,NF ln.n Nom> ;
False => <Neutr,Strong,NF Sg Nom> } ;
af = agrAdj gan.p1 gan.p2 gan.p3 ;
in preOrPost ap.isPre
(ap.s ! agrP3 Sg ! af)
(ln.s ! a ! c) ;
} ;
}

View File

@@ -85,6 +85,8 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in {
NumDigits numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ;
OrdDigits numeral = {s = \\af => numeral.s ! NOrd af} ;
NumDecimal numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ;
NumNumeral numeral = {s = \\g,c => numeral.s ! NCard g c; n = numeral.n } ;
OrdNumeral numeral = {s = let tiende : AForm => Str = \\af => numeral.s ! NOrd af
in table {APred => tiende ! AAttr Utr ;
@@ -199,4 +201,10 @@ concrete NounDut of Noun = CatDut ** open ResDut, Prelude in {
DetDAP det = det ;
QuantityNP n m = noMerge ** {
s = \\c => preOrPost m.isPre m.s (n.s ! NCard Utr Nom) ;
a = agrP3 n.n ;
isPron = False
} ;
}

View File

@@ -1,4 +1,4 @@
concrete NumeralDut of Numeral = CatDut [Numeral,Digits] ** open ResDut, Prelude in {
concrete NumeralDut of Numeral = CatDut [Numeral,Digits,Decimal] ** open ResDut, Prelude in {
flags optimize = all_subs ;
coding=utf8 ;
@@ -74,6 +74,20 @@ lin
D_8 = mkDig "8" ;
D_9 = mkDig "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = \\o => "-" ++ BIND ++ d.s ! o ;
n = Pl ;
hasDot=False
} ;
IFrac d i = {
s = \\o => d.s ! invNum ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! o ;
n = Pl ;
hasDot=True
} ;
oper
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ;

View File

@@ -76,6 +76,24 @@ oper
mkPN : N -> PN ; -- proper name from noun
} ;
mkGN = overload { -- given name
mkGN : Str -> GN = \s -> lin GN {s = \\_ => s; g = Male} ;
mkGN : Str -> Sex -> GN = \s,g -> lin GN {s = \\_ => s; g = g} ;
} ;
mkSN = overload { -- given name
mkSN : Str -> SN = \s -> lin SN {s = \\_,_ => s; pl = \\_=>s} ;
mkSN : Str -> Str -> Str -> SN = \male,female,pl -> lin SN {s = table {Male=>\\_=>male; Female=>\\_=>female}; pl=\\_=>pl} ;
} ;
mkLN = overload {
mkLN : Str -> LN -- location name
= \s -> lin LN {s = \\_,_ => s; hasArt = False; n = Sg} ;
mkLN : Str -> Number -> LN -- location name
= \s,n -> lin LN {s = \\_,_ => s; hasArt = False; n = n} ;
} ;
defLN : LN -> LN = \n -> n ** {hasArt = True} ;
--2 Adjectives
@@ -249,6 +267,10 @@ oper
de,utrum = Utr ;
nominative = Nom ;
genitive = Gen ;
male = Male ;
female = Female ;
singular = Sg ;
plural = Pl ;
mkA = overload {
mkA : (vers : Str) -> A = \a -> lin A (regAdjective a) ;
@@ -439,4 +461,6 @@ oper
--
--}
mkMU : Str -> MU = \s -> lin MU {s=s; isPre=False} ;
}

View File

@@ -71,6 +71,20 @@ lin pot3plus n m = { s = table {
D_8 = mkDig "8" ;
D_9 = mkDig "9" ;
PosDecimal d = d ** {hasDot=False} ;
NegDecimal d = {
s = \\o,g => "-" ++ BIND ++ d.s ! o ! g ;
n = Pl
hasDot=False
} ;
IFrac d i = {
s = \\o,g => d.s ! NCard ! g ++
if_then_Str d.hasDot BIND (BIND++"."++BIND) ++
i.s ! o ! g;
n = Pl ;
hasDot=True
} ;
oper
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
mkDig : Str -> TDigit = \c -> mk2Dig c (c ) ;

View File

@@ -81,6 +81,7 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in {
Numeral = {s : Bool => CardOrd => Case => Str ; n : Number} ;
Digits = {s : CardOrd => Case => Str ; n : Number ; tail : DTail} ;
Decimal = {s : CardOrd => Case => Str ; n : Number ; hasDot : Bool} ;
-- Structural
@@ -106,7 +107,14 @@ concrete CatEng of Cat = CommonX - [Pol,CAdv] ** open ResEng, Prelude in {
N = {s : Number => Case => Str ; g : Gender} ;
N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str} ;
N3 = {s : Number => Case => Str ; g : Gender} ** {c2,c3 : Str} ;
GN, SN, PN = {s : Case => Str ; g : Gender} ;
PN = {s : Case => Str ; g : Gender} ;
GN = {s : Case => Str ; g : Sex} ;
SN = {s : Sex => Case => Str; p : Case => Str} ;
LN = {s : Case => Str;
prep : LNPrep; -- preposition "in Scandinavia", "on the Balkans", "at the South Pole"
art : Bool; -- plain name "United States" vs "the United States"
n : Number;
} ;
lindef
SSlash = \s -> {s = s; c2 = ""} ;

Some files were not shown because too many files have changed in this diff Show More