| Line 15: |
Line 15: |
| | The basic idea of a generative grammar is to provide a set of rules which are capable of generating all possible grammatical sentences in some language; the rules also constrain generation so that only grammatical sentences are generated. The rules can also be used in reverse to parse a sentence and check if it is grammatical. | | The basic idea of a generative grammar is to provide a set of rules which are capable of generating all possible grammatical sentences in some language; the rules also constrain generation so that only grammatical sentences are generated. The rules can also be used in reverse to parse a sentence and check if it is grammatical. |
| | | | |
| − | ==Simple example== | + | ==Example of a very simple generative grammar== |
| − | The very simple example here is based on one by David Crystal.
| + | This very simple example can handle only a tiny subset of English and should not be taken seriously as a guide to English grammar or vocabulary. It is based on an example by David Crystal. |
| | <ref>{{cite book | | <ref>{{cite book |
| | | last = Crystal | | | last = Crystal |
| Line 25: |
Line 25: |
| | | isbn = 978052126438 | | | isbn = 978052126438 |
| | | pages = page 97 | | | pages = page 97 |
| − | }}</ref> The symbol "->" means "can be replaced by". When there are several items on the right hand side separated by commas, any one of these items can be selected. | + | }}</ref> |
| | | | |
| − | ''Sentence'' -> ''NounPhrase'' ''VerbPhrase'' | + | The symbol "->" means "can be replaced by". When there are several items on the right hand side separated by commas, any one of these items can be selected. The comments preceded by "#" are not part of the generative grammar, but hopefully will help folks understand the example a little better. |
| − | ''NounPhrase'' -> ''Determiner'' ''Noun'' | + | |
| − | ''VerbPhrase'' -> ''Verb'' ''NounPhrase'' | + | ''Sentence'' -> ''NounPhrase'' ''VerbPhrase'' # A ''Sentence'' consists of a ''NounPhrase'' followed by a ''VerbPhrase'' |
| − | ''Determiner'' -> '''a''', '''the''' | + | ''NounPhrase'' -> ''Determiner'' ''Noun'' # A ''NounPhrase'' consists of a ''Determiner'' followed by a ''Noun'' |
| − | ''Noun'' -> '''boy''', '''girl''', '''dog''' | + | ''VerbPhrase'' -> ''Verb'' ''NounPhrase'' # A ''VerbPhrase'' consists of a ''Verb'' followed by a ''NounPhrase'' |
| − | ''Verb'' -> '''chased''', '''heard''', '''saw''' | + | ''Determiner'' -> '''a''', '''the''' # A ''Determiner'' is either '''a''' or '''the''' |
| | + | ''Noun'' -> '''boy''', '''girl''', '''dog''' # A ''Noun'' is one of: '''boy''' or '''girl''' or '''dog''' |
| | + | ''Verb'' -> '''chased''', '''heard''', '''saw''' # A ''Verb'' is one of: '''chased''' or '''heard''' or '''saw''' |
| | | | |
| | By making appropriate substitutions we can generate such sentences as: | | By making appropriate substitutions we can generate such sentences as: |
| Line 38: |
Line 40: |
| | :The girl heard the dog. | | :The girl heard the dog. |
| | :The boy saw a girl. | | :The boy saw a girl. |
| | + | |
| | + | The stages in the generation of these examples are as follows: |
| | + | :''Sentence'' |
| | + | :''NounPhrase'' ''VerbPhrase'' |
| | + | :''Determiner'' ''Noun'' ''Verb'' ''NounPhrase'' |
| | + | :''Determiner'' ''Noun'' ''Verb'' ''Determiner'' ''Noun'' |
| | | | |
| | ==Chomsky hierarchy== | | ==Chomsky hierarchy== |