German Fragment

This is a simple German grammar including only the barest noun phrases and simplest declaratives. It contains intransitive, transitive, and ditransitive verbs and accounts for the cases needed by these verbs (nominative, accusative, and dative). One adjective is thrown in to demonstrate the special agreement required between the article of the NP (so-called ein-words, der-words, etc.) and the adjective. For this I introduced a new feature, DEF. Actually agreement has to do with more than just (in)definiteness, but in my small grammar this simplification fares well enough. For the nitty-gritty, see the Wikipedia page on German adjectives.

My grammar rightly includes these sentences:

  • der gute Mann kauft mir einen guten Hund
  • der Hund bellt
  • er bellt
  • die Maenner kochen die Wuerste
  • der Mann spaziert
  • ich spaziere
  • eine gute Katze liebt die Kanzlerin
  • du liebst sie
  • ich kaufe ihnen eine Wurst

And it rightly excludes these:

  • *die Wuerste lieben die Katze
  • *der Kanzlerin bellt
  • *die Maenner erstickst
  • *ich kaufe es ihm
  • *ich spaziere den Mann

For the sake of those wishing to learn from this grammar, I will caution that it under-generates, that is, it produces some false-negatives. For example, I could not get unpreceded adjectives to carry a default declension, and so sentences like the following are wrongly left unparsed.

  • Guter Maenner kochen [Good men cook]

It occurs to me that adding complementary features like prec/unprec to the determiners and adjectives could do the job. But still, this isn't very elegant, and it would only postpone more problems. For example, predicative adjectives (die Wurst ist gut) would then (incorrectly) decline.

Here is the complete code:

############ German ####################################
## Lee Beck, April 2007

####################### Features #######################

feature {
   	CASE<2>: 	nom 		acc 		dat;
   	NUM<2>: 	sg 		pl;
   	PERS<2>: 	non-3rd 	{1st 		2nd} 		3rd;
   	GEND<2>: 	masc 		fem 		neut 		pl-g;
   	DEF<2>: 	def 		indef;
   	
   	TENSE<E>: past present;
 	SEM-NUM<X:NUM>: sg-X pl-X;
 	
 	ontology:	sem-obj {
              		phys-obj {
                		animate-being {
                			person
                			animal
                		}
                		thing
              		}
              		situation {
                		change {
                  			action
                		}
                		state
              		}
            	};
 }

######################### Words #########################

word deter:Det{
	das:	neut	nom		def;
	der:	masc	nom		def;
	die:	fem	nom		def;
	die:	pl-g	nom		def;
	das:	neut	acc		def;
	den:	masc	acc		def;
	die:	fem	acc		def;
	die:	pl-g	acc		def;
	dem:	neut	dat		def;
	dem:	masc	dat		def;
	der:	fem	dat		def;
	den:	pl-g	dat		def;
	ein:	masc	nom	sg	indef;
	eine:	fem	nom	sg	indef;
	ein:	neut	nom	sg	indef;
	einen:	masc	acc	sg	indef;
	eine:	fem	acc	sg	indef;
	ein:	neut	acc	sg	indef;
	einem:	masc	dat	sg	indef;
	einer:	fem	dat	sg	indef;
	einem:	neut	dat	sg	indef;
}

word pro1:Pro(person) {
  	ich:	1st 	sg 		nom 	sg-X;
  	mich: 	1st 	sg 		acc 	sg-X;
  	mir:	1st	sg		dat	sg-X;
  	wir: 	1st 	pl 		nom 	pl-X;
  	uns: 	1st 	pl 		acc 	pl-X;
  	uns:	1st	pl		dat	pl-X;
}

word pro2:Pro(person) {
  	du:	2nd 	sg 		nom 	sg-X;
  	dich: 	2nd 	sg 		acc 	sg-X;
  	dir:	2nd	sg		dat	sg-X;
  	ihr: 	2nd 	pl 		nom 	pl-X;
  	euch: 	2nd 	pl 		acc 	pl-X;
  	euch:	2nd	pl		dat	pl-X;
}

word pro3:Pro(person) {
  	er:	3rd	sg		nom		sg-X	masc;
  	ihn:	3rd	sg		acc		sg-X	masc;
  	ihm:	3rd 	sg		dat		sg-X	masc;
  	sie:	3rd	sg		nom		sg-X	fem;
  	sie:	3rd	sg		acc		sg-X	fem;
  	ihr:	3rd 	sg		dat		sg-X	fem;
  	sie:	3rd	pl		nom		pl-X	pl-g;
  	sie:	3rd	pl		acc		pl-X	pl-g;
  	ihnen:	3rd 	pl		dat		pl-X	pl-g;
}

word pro3:Pro(sem-obj) {
  	es:	3rd	sg		nom		sg-X	neut;
  	es:	3rd	sg		acc		sg-X	neut;
  	ihm:	3rd 	sg		dat		sg-X	neut;
}

def noun(Sing, Plur, Pred, Gend, Class) {
	word Sing:N (pred=Pred class=Class) {
		*: sg 3rd sg-X Gend;
		Plur: pl 3rd pl-X pl-g;
	}
}

noun(Hund, Hunde, dog, masc, animal)
noun(Katze, Katzen, cat, fem, animal)
noun(Kanzlerin, Kanzlerinnen, chancellor, fem, person)
noun(Mann, Maenner, man, masc, person)
noun(Wurst, Wuerste, sausage, fem, thing)


# most regular verbs
def reg-verb(Stem, Pred, Props) {
	word Stem:Props (pred=Pred) {
		Stem . e:	present 1st sg;
		Stem . en:	present 1st pl;
		Stem . st:	present 2nd sg;
		Stem . t:	present 2nd pl;
		Stem . t: 	present 3rd sg;
		Stem . en: 	present	3rd pl;
	}
}

reg-verb(spazier, stroll, IntransV)
reg-verb(erstick, choke, IntransV)
reg-verb(bell, bark, IntransV)
reg-verb(koch, cook, TransV)
reg-verb(lieb, love, TransV)
reg-verb(kauf, buy, DiTransV)

def adjective(Stem, Pred) {
	word Stem:Adj (pred=Pred) {
		Stem . e:	masc 	nom	def;
		Stem . en:	masc	acc	def;
		Stem . en:	masc	dat	def;	
		Stem . e:	fem	nom	def;	
		Stem . e:	fem	acc	def;
		Stem . en:	fem	dat	def;
		Stem . e:	neut	nom	def;
		Stem . e:	neut	acc	def;
		Stem . en:	neut	dat	def;
		Stem . en: 	pl-g	nom	def;
		Stem . en: 	pl-g	acc	def;
		Stem . en: 	pl-g	dat	def;
		Stem . er:	masc 	nom	indef;
		Stem . en:	masc	acc	indef;
		Stem . en:	masc	dat	indef;
		Stem . e:	fem	nom	indef;
		Stem . e:	fem	acc	indef;
		Stem . en:	fem	dat	indef;
		Stem . es:	neut	nom	indef;
		Stem . es:	neut	acc	indef;
		Stem . en:	neut	dat	indef;
		Stem . e: 	pl-g	nom	indef;
		Stem . e: 	pl-g	acc	indef;
		Stem . en: 	pl-g	dat	indef;
	}
}

## I do not know how to allow for adjectives endings that 
## do not follow an article. That rule would go here.

adjective(gut, good)

######################### Rules #########################

################## Lexicon/Categories ####################

family Det(indexRel=det) {
	entry: 	np<2>[X PERS=3rd] /^ n<2>[X]:
    		X:sem-obj(<det>*);
}


family Adj(indexRel=adj) {
  entry: n<2>[X] / n<2>[X]:
         X:sem-obj(<adj>*);
}


family N {
	entry: n<2> [X] : X:sem-obj(*);
}

family Pro {
  entry: np<2>[X]:
         X:sem-obj(*);  
}

family IntransV(V) {
	entry: 	s<1>[E] \ np<2>[X nom] :
			E:action(* <Actor>X:animate-being);
} 

family TransV(V) {
	entry: 	s<1>[E] \ np<2>[X nom] / np<3>[Y acc]:
			E:action(* <Actor>X:animate-being <Patient>Y:sem-obj);
} 

family DiTransV(V) {
	entry:	s<1>[E] \ np<2>[X nom] / np<3>[Y acc] / np<4>[Z dat]:
			E:action(* <Actor>X:animate-being <Patient>Y:sem-obj <Benefactor>Z:person);
}


####################### Testbed #########################

 testbed {
	der gute Mann kauft mir einen guten Hund: 1;
	der Hund bellt: 1;
	er bellt: 1;
	die Maenner kochen die Wuerste: 1;
	der Mann spaziert: 1;
	ich spaziere: 1;
	eine gute Katze liebt die Kanzlerin: 1;
	du liebst sie: 2;
	ich kaufe ihnen eine Wurst: 1;
	die Wuerste lieben die Katze: 0;
	der Kanzlerin bellt: 0;
	die Maenner erstickst: 0;
	ich kaufe es ihm: 0;
	ich spaziere den Mann: 0;
 }
 
openccg/grammars/german.txt · Last modified: 2007/04/26 03:10 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki