Skip to content

Commit

Permalink
Add RGL's NumeralDut.gf with a tiny modification
Browse files Browse the repository at this point in the history
This was needed to get generalized quantifiers (e.g. `at least`, `exactly`)
to work in Dutch.

The modification was to restrict the inheritance of CatDut to [Numeral,Digits].
A similar restriction is done in RGL's NumeralGer. Before, this restriction was
applied in AttemptoDut to NumeralDut but in this case the Card-category will
not be present which results in empty linearizations.

Hopefully the modified NumeralDut.gf can be pushed into the RGL because it
really shouldn't be part of ACE-in-GF.
  • Loading branch information
Kaljurand committed May 12, 2012
1 parent 0f54771 commit b206a08
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ all_test:
all_ontograph_40:
gf --batch --path=$(path) $(foreach lang,$(languages),$(words_onto)/TestAttempto$(lang).gf)

pgf_ontograph_40:
gf --make --path=$(path) $(foreach lang,$(languages),$(words_onto)/TestAttempto$(lang).gf)

# Parse ontograph_40 sentences and linearise into all languages
lin_ontograph_40:
echo "rf -lines -file=$(tests_onto)/sentences.txt | p -lang=Ace -cat=ACEText | l -treebank" | \
Expand Down
2 changes: 1 addition & 1 deletion grammars/acewiki_aceowl/AttemptoDut.gf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--# -path=.:present

concrete AttemptoDut of Attempto = NumeralDut [Numeral, Digits], SymbolsC ** AttemptoI
concrete AttemptoDut of Attempto = NumeralDut, SymbolsC ** AttemptoI
with
(Syntax = SyntaxDut),
(Symbolic = SymbolicDut),
Expand Down
111 changes: 111 additions & 0 deletions grammars/acewiki_aceowl/NumeralDut.gf
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
concrete NumeralDut of Numeral = CatDut [Numeral,Digits] ** open ResDut, Prelude in {

flags optimize = all_subs ;

lincat
Digit = {s : DForm => CardOrd => Str ; en : Str} ;
Sub10 = {s : DForm => CardOrd => Str ; n : Number ; en : Str ; attr : Str} ;
Sub100, Sub1000, Sub1000000 =
{s : CardOrd => Str ; n : Number ; attr : Str} ;

lin
num x = x ;

n2 = mkDigit "twee" "twaalf" "twintig" "tweede" ;
n3 = mkDigit "drie" "dertien" "dertig" "derde" ;
n4 = mkDigit "vier" "veertien" "veertig" "vierde" ;
n5 = mkDigit "vijf" "vijftien" "vijftig" "vijfde" ;
n6 = mkDigit "zes" "zestien" "zestig" "zesde" ;
n7 = mkDigit "zeven" "zeventien" "zeventig" "zevende" ;
n8 = mkDigit "acht" "achttien" "tachtig" "achtste" ;
n9 = mkDigit "negen" "negentien" "negentig" "negende" ;

pot01 = {
s = \\f => table {
NCard g _ => "een" ; ---- "één" ;
NOrd af => (regAdjective "eerst").s ! Posit ! af
} ;
n = Sg ;
attr = [] ;
en = "en"
} ;
pot0 d = {s = \\f,g => d.s ! f ! g ; n = Pl ; en = d.en ; attr = d.s ! DUnit ! invNum ++ BIND} ;
pot110 = {s = cardOrd "tien" "tiende" ; n = Pl ; attr = "tien" ++ BIND} ;
pot111 = {s = cardOrd "elf" "elfde" ; n = Pl ; attr = "elf" ++ BIND} ;
pot1to19 d = addAttr {s = d.s ! DTeen ; n = Pl} ;
pot0as1 n = {s = n.s ! DUnit; n = n.n ; attr = n.attr} ;
pot1 d = addAttr {s = d.s ! DTen ; n = Pl} ;
pot1plus d e = addAttr {s = \\g =>
e.s ! DUnit ! invNum ++ BIND ++ e.en ++ BIND ++ d.s ! DTen ! g ; n = Pl} ;
pot1as2 n = n ;
pot2 d =
addAttr {s = \\g => d.attr ++ cardOrd "honderd" "honderdste" ! g ; n = Pl} ;
pot2plus d e =
addAttr {s = \\g => d.attr ++ "honderd" ++ BIND ++ e.s ! g ; n = Pl} ;
pot2as3 n = n ;
pot3 n =
addAttr {s = \\g => n.attr ++ cardOrd "duizend" "duizendste" ! g ; n = Pl} ;
pot3plus n m =
addAttr {s = \\g => n.attr ++ "duizend" ++ m.s ! g ; n = Pl} ;


lincat
Dig = TDigit ;

lin
IDig d = d ;

IIDig d i = {
s = \\o => d.s ! invNum ++ i.s ! o ;
n = Pl
} ;

D_0 = mkDig "0" ;
D_1 = mk3Dig "1" "1e" Sg ;
D_2 = mk2Dig "2" "2e" ;
D_3 = mkDig "3" ;
D_4 = mkDig "4" ;
D_5 = mkDig "5" ;
D_6 = mkDig "6" ;
D_7 = mkDig "7" ;
D_8 = mkDig "8" ;
D_9 = mkDig "9" ;

oper
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
mkDig : Str -> TDigit = \c -> mk2Dig c (c + "e") ;

mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> {
s = table {NCard _ _ => c ; NOrd _ => o} ;
n = n
} ;

TDigit = {
n : Number ;
s : CardOrd => Str
} ;

LinDigit = {s : DForm => CardOrd => Str ; en : Str} ;

cardOrd : Str -> Str -> CardOrd => Str = \drei,dritte ->
let dritt = init dritte in
table {
NCard _ _ => drei ;
NOrd a => (regAdjective dritt).s ! Posit ! a
} ;

mkDigit : (x1,_,_,x4 : Str) -> LinDigit =
\drei,dreizehn,dreissig,dritte ->
{s = table {
DUnit => cardOrd drei dritte ;
DTeen => cardOrd dreizehn (dreizehn + "de") ;
DTen => cardOrd dreissig (dreissig + "ste")
} ;
en = case drei of {_ + "e" => "ën" ; _ => "en"}
} ;
invNum : CardOrd = NCard Utr Nom ;

addAttr : {s : CardOrd => Str ; n : Number} ->
{s : CardOrd => Str ; n : Number ; attr : Str} = \n -> n ** {attr = n.s ! invNum ++ BIND} ;

}
12 changes: 6 additions & 6 deletions tests/ontograph_40/lin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ TestAttemptoSwe: [np_coord_VPS] .

TestAttempto: baseText (sText (simpleS_as_S (vpS (pnNP tom_PN) (v2VP love_V2 (thereNP_as_NP (at_leastNP (digitsCard (IDig D_2)) (cn_as_VarCN officer_N)))))))
TestAttemptoAce: Tom loves at least 2 officers .
TestAttemptoDut:
TestAttemptoDut: Tom heeft ten minste 2 politieagenten lief .
TestAttemptoEng: Tom loves at least 2 officers .
TestAttemptoFin: Tom rakastaa vähintään 2 upseeria .
TestAttemptoFre: Tom aime au moins 2 officiers .
Expand All @@ -260,7 +260,7 @@ TestAttemptoSwe: Tom älskar minst 2 befälar .

TestAttempto: baseText (sText (simpleS_as_S (vpS (pnNP lisa_PN) (v2VP buy_V2 (thereNP_as_NP (at_mostNP (digitsCard (IDig D_1)) (cn_as_VarCN present_N)))))))
TestAttemptoAce: Lisa buys at most 1 present .
TestAttemptoDut:
TestAttemptoDut: Lisa koopt hooguit 1 cadeau .
TestAttemptoEng: Lisa buys at most 1 present .
TestAttemptoFin: Lisa ostaa enintään 1 lahjan .
TestAttemptoFre: Lisa achète au plus 1 cadeau .
Expand All @@ -270,7 +270,7 @@ TestAttemptoSwe: Lisa köper högst 1 present .

TestAttempto: baseText (sText (simpleS_as_S (vpS (everyNP (cn_as_VarCN traveler_N)) (v2VP see_V2 (thereNP_as_NP (at_leastNP (digitsCard (IDig D_2)) (cn_as_VarCN aquarium_N)))))))
TestAttemptoAce: every traveler sees at least 2 aquariums .
TestAttemptoDut:
TestAttemptoDut: elke reiziger ziet ten minste 2 aquariums .
TestAttemptoEng: every traveler sees at least 2 aquariums .
TestAttemptoFin: jokainen matkustajan näkee vähintään 2 akvaariota .
TestAttemptoFre: chaque voyageur voit au moins 2 aquariums .
Expand All @@ -280,7 +280,7 @@ TestAttemptoSwe: varje resenär ser minst 2 akvariumar .

TestAttempto: baseText (sText (simpleS_as_S (vpS (relNP (thereNP_as_NP (indefPronNP everything_IPron)) (predRS which_RP (v2VP buy_V2 (thereNP_as_NP (at_leastNP (digitsCard (IDig D_2)) (cn_as_VarCN present_N)))))) (npVP (thereNP_as_NP (aNP (cn_as_VarCN officer_N)))))))
TestAttemptoAce: everything which buys at least 2 presents is an officer .
TestAttemptoDut:
TestAttemptoDut: alles , dat ten minste 2 cadeau's koopt is een politieagent .
TestAttemptoEng: everything which buys at least 2 presents is an officer .
TestAttemptoFin: kaikki , joka ostaa vähintään 2 lahjaa on upseeri .
TestAttemptoFre: tout qui achète au moins 2 cadeaux est un officier .
Expand All @@ -290,7 +290,7 @@ TestAttemptoSwe: allting , som köper minst 2 presentar är en befäl .

TestAttempto: baseText (sText (simpleS_as_S (vpS (everyNP (cn_as_VarCN officer_N)) (v2VP see_V2 (thereNP_as_NP (at_mostNP (digitsCard (IDig D_1)) (cn_as_VarCN aquarium_N)))))))
TestAttemptoAce: every officer sees at most 1 aquarium .
TestAttemptoDut:
TestAttemptoDut: elke politieagent ziet hooguit 1 aquarium .
TestAttemptoEng: every officer sees at most 1 aquarium .
TestAttemptoFin: jokainen upseeri näkee enintään 1 akvaarion .
TestAttemptoFre: chaque officier voit au plus 1 aquarium .
Expand All @@ -300,7 +300,7 @@ TestAttemptoSwe: varje befäl ser högst 1 akvarium .

TestAttempto: baseText (sText (simpleS_as_S (vpS (relNP (thereNP_as_NP (indefPronNP everything_IPron)) (orRS (predRS which_RP (npVP (thereNP_as_NP (aNP (cn_as_VarCN traveler_N))))) (predRS which_RP (npVP (thereNP_as_NP (aNP (cn_as_VarCN officer_N))))))) (v2VP see_V2 (thereNP_as_NP (at_mostNP (digitsCard (IDig D_1)) (cn_as_VarCN aquarium_N)))))))
TestAttemptoAce: everything which is a traveler or which is an officer sees at most 1 aquarium .
TestAttemptoDut:
TestAttemptoDut: alles , dat een reiziger is of dat een politieagent is ziet hooguit 1 aquarium .
TestAttemptoEng: everything which is a traveler or which is an officer sees at most 1 aquarium .
TestAttemptoFin: kaikki , joka on matkustajan tai joka on upseeri näkee enintään 1 akvaarion .
TestAttemptoFre: tout qui est un voyageur ou qui est un officier voit au plus 1 aquarium .
Expand Down
2 changes: 1 addition & 1 deletion words/ontograph_40/TestAttemptoDut.gf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ lin
woman_N = mkCN L.woman_N ;
golfer_N = mkkN "golfspeler" ;
present_N = mkkN "cadeau" ;
aquarium_N = mkkN "aquarium" ;
aquarium_N = mkCN (mkN "aquarium" "aquariums" het);
picture_N = mkkN "afbeelding" ;
person_N = mkCN L.person_N ;

Expand Down

0 comments on commit b206a08

Please sign in to comment.