Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nltk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
nltk
Commits
a1273986
Commit
a1273986
authored
Jun 14, 2007
by
Ewan Klein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reinstated metadata for .cfg files.
Renamed 'german0.cfg'. svn/trunk@4672
parent
1f5a0928
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
171 additions
and
112 deletions
+171
-112
examples/parse/feat0.cfg
+16
-4
examples/parse/feat1.cfg
+17
-4
examples/parse/german.cfg
+80
-68
examples/semantics/chat80.cfg
+17
-14
examples/semantics/sem0.cfg
+9
-6
examples/semantics/sem1.cfg
+10
-5
examples/semantics/sem2.cfg
+12
-7
examples/semantics/sem3.cfg
+10
-4
No files found.
examples/parse/feat0.cfg
View file @
a1273986
## Natural Language Toolkit: feat0.cfg
##
## First example of a feature-based grammar for English, illustrating
## value-sharing of NUM and TENSE features.
## Used in Feature-Based Grammars chapter.
##
## Author: Ewan Klein <ewan@inf.ed.ac.uk>
## URL: <http://nltk.sourceforge.net>
## For license information, see LICENSE.TXT
##
## $Id:$
% start S
% start S
#############################
#
############################
# Grammar Rules
# Grammar Rules
#############################
#
############################
# S expansion rules
# S expansion rules
S -> NP[NUM=?n] VP[NUM=?n]
S -> NP[NUM=?n] VP[NUM=?n]
...
@@ -16,9 +28,9 @@ NP[NUM=pl] -> N[NUM=pl]
...
@@ -16,9 +28,9 @@ NP[NUM=pl] -> N[NUM=pl]
VP[TENSE=?t, NUM=?n] -> IV[TENSE=?t, NUM=?n]
VP[TENSE=?t, NUM=?n] -> IV[TENSE=?t, NUM=?n]
VP[TENSE=?t, NUM=?n] -> TV[TENSE=?t, NUM=?n] NP
VP[TENSE=?t, NUM=?n] -> TV[TENSE=?t, NUM=?n] NP
#############################
#
############################
# Lexical Rules
# Lexical Rules
#############################
#
############################
Det[NUM=sg] -> 'this' | 'every'
Det[NUM=sg] -> 'this' | 'every'
Det[NUM=pl] -> 'these' | 'all'
Det[NUM=pl] -> 'these' | 'all'
...
...
examples/parse/feat1.cfg
View file @
a1273986
## Natural Language Toolkit: feat1.cfg
##
## Second example of a feature-based grammar, illustrating
## SUBCAT and slash features. Also introduces S-BAR and embedded
## clauses.
## Used in Feature-Based Grammars chapter.
##
## Author: Ewan Klein <ewan@inf.ed.ac.uk>
## URL: <http://nltk.sourceforge.net>
## For license information, see LICENSE.TXT
##
## $Id:$
% start S
% start S
#############################
#
############################
# Grammar Rules
# Grammar Rules
#############################
#
############################
S[-INV] -> NP S/NP
S[-INV] -> NP S/NP
S[-INV]/?x -> NP VP/?x
S[-INV]/?x -> NP VP/?x
S[+INV]/?x -> V[+AUX] NP VP/?x
S[+INV]/?x -> V[+AUX] NP VP/?x
...
@@ -13,9 +26,9 @@ VP/?x -> V[SUBCAT=1, -AUX] NP/?x
...
@@ -13,9 +26,9 @@ VP/?x -> V[SUBCAT=1, -AUX] NP/?x
VP/?x -> V[SUBCAT=2, -AUX] S-BAR/?x
VP/?x -> V[SUBCAT=2, -AUX] S-BAR/?x
VP/?x -> V[SUBCAT=3, +AUX] VP/?x
VP/?x -> V[SUBCAT=3, +AUX] VP/?x
#############################
#
############################
# Lexical Rules
# Lexical Rules
#############################
#
############################
V[SUBCAT=1, -AUX] -> 'see' | 'like'
V[SUBCAT=1, -AUX] -> 'see' | 'like'
V[SUBCAT=2, -AUX] -> 'say' | 'claim'
V[SUBCAT=2, -AUX] -> 'say' | 'claim'
V[SUBCAT=3, +AUX] -> 'do' | 'can'
V[SUBCAT=3, +AUX] -> 'do' | 'can'
...
...
examples/parse/german
0
.cfg
→
examples/parse/german.cfg
View file @
a1273986
# german0.cfg
## Natural Language Toolkit: german.cfg
# Author: Contributed by Michaela Atterer <atterer@ims.uni-stuttgart.de>
##
# Ewan Klein <ewan@inf.ed.ac.uk>
## Example of a feature-based grammar for German, illustrating
## CASE and AGR features (PER, GND, NUM) working as a bundle.
% start S
## Used in Feature-Based Grammars chapter.
################
##
# Grammar Rules
## Author: Michaela Atterer <atterer@ims.uni-stuttgart.de>
################
## Ewan Klein <ewan@inf.ed.ac.uk>
S -> NP[CASE=nom, AGR=?a] VP[AGR=?a]
##
## $Id:$
NP[CASE=?c, AGR=?a] -> PRO[CASE=?c, AGR=?a]
NP[CASE=?c, AGR=?a] -> Det[CASE=?c, AGR=?a] N[CASE=?c, AGR=?a]
% start S
################
VP[AGR=?a] -> IV[AGR=?a]
# Grammar Rules
VP[AGR=?a] -> TV[OBJCASE=?c, AGR=?a] NP[CASE=?c]
################
S -> NP[CASE=nom, AGR=?a] VP[AGR=?a]
###############
# Lexical Rules
NP[CASE=?c, AGR=?a] -> PRO[CASE=?c, AGR=?a]
###############
NP[CASE=?c, AGR=?a] -> Det[CASE=?c, AGR=?a] N[CASE=?c, AGR=?a]
# SG determiners
VP[AGR=?a] -> IV[AGR=?a]
# masc
VP[AGR=?a] -> TV[OBJCASE=?c, AGR=?a] NP[CASE=?c]
Det[CASE=nom, AGR=[GND=masc,PER=3,NUM=sg]] -> 'der'
Det[CASE=dat, AGR=[GND=masc,PER=3,NUM=sg]] -> 'dem'
###############
Det[CASE=acc, AGR=[GND=masc,PER=3,NUM=sg]] -> 'den'
# Lexical Rules
###############
# fem
# Singular determiners
Det[CASE=nom, CASE=nom, AGR=[GND=fem,PER=3,NUM=sg]] -> 'die'
Det[CASE=dat, AGR=[GND=fem,PER=3,NUM=sg]] -> 'der'
# masc
Det[CASE=acc, AGR=[GND=fem,PER=3,NUM=sg]] -> 'die'
Det[CASE=nom, AGR=[GND=masc,PER=3,NUM=sg]] -> 'der'
Det[CASE=dat, AGR=[GND=masc,PER=3,NUM=sg]] -> 'dem'
# Plural determiners
Det[CASE=acc, AGR=[GND=masc,PER=3,NUM=sg]] -> 'den'
Det[CASE=nom, AGR=[PER=3,NUM=pl]] -> 'die'
Det[CASE=dat, AGR=[PER=3,NUM=pl]] -> 'den'
# fem
Det[CASE=acc, AGR=[PER=3,NUM=pl]] -> 'die'
Det[CASE=nom, CASE=nom, AGR=[GND=fem,PER=3,NUM=sg]] -> 'die'
Det[CASE=dat, AGR=[GND=fem,PER=3,NUM=sg]] -> 'der'
# Nouns
Det[CASE=acc, AGR=[GND=fem,PER=3,NUM=sg]] -> 'die'
N[AGR=[GND=masc,PER=3,NUM=sg]] -> 'hund'
N[AGR=[PER=3,NUM=pl]] -> 'hunde'
# Plural determiners
Det[CASE=nom, AGR=[PER=3,NUM=pl]] -> 'die'
N[AGR=[GND=fem,PER=3,NUM=sg]] -> 'katze'
Det[CASE=dat, AGR=[PER=3,NUM=pl]] -> 'den'
N[AGR=[GND=fem,PER=3,NUM=pl]] -> 'katzen'
Det[CASE=acc, AGR=[PER=3,NUM=pl]] -> 'die'
PRO[CASE=nom, AGR=[PER=1,NUM=sg]] -> 'ich'
# Nouns
PRO[CASE=acc, AGR=[PER=1,NUM=sg]] -> 'mich'
N[AGR=[GND=masc,PER=3,NUM=sg]] -> 'hund'
PRO[CASE=dat, AGR=[PER=1,NUM=sg]] -> 'mir'
N[AGR=[PER=3,NUM=pl]] -> 'hunde'
PRO[CASE=nom, AGR=[PER=2,NUM=sg]] -> 'du'
N[CASE=nom, AGR=[PER=3,NUM=pl]] -> 'hunde'
PRO[CASE=nom, AGR=[PER=3,NUM=sg]] -> 'er' | 'sie' | 'es'
N[CASE=dat, AGR=[PER=3,NUM=pl]] -> 'hunden'
PRO[CASE=nom, AGR=[PER=1,NUM=pl]] -> 'wir'
N[CASE=acc, AGR=[PER=3,NUM=pl]] -> 'hunde'
PRO[CASE=nom, AGR=[PER=1,NUM=pl]] -> 'uns'
PRO[CASE=nom, AGR=[PER=2,NUM=pl]] -> 'ihr'
N[AGR=[GND=fem,PER=3,NUM=sg]] -> 'katze'
PRO[CASE=nom, AGR=[PER=3,NUM=pl]] -> 'sie'
N[AGR=[GND=fem,PER=3,NUM=pl]] -> 'katzen'
IV[AGR=[NUM=sg,PER=1]] -> 'komme'
# Pronouns
IV[AGR=[NUM=sg,PER=2]] -> 'kommst'
PRO[CASE=nom, AGR=[PER=1,NUM=sg]] -> 'ich'
IV[AGR=[NUM=sg,PER=3]] -> 'kommt'
PRO[CASE=acc, AGR=[PER=1,NUM=sg]] -> 'mich'
IV[AGR=[NUM=pl, PER=1]] -> 'kommen'
PRO[CASE=dat, AGR=[PER=1,NUM=sg]] -> 'mir'
IV[AGR=[NUM=pl, PER=2]] -> 'kommst'
PRO[CASE=nom, AGR=[PER=2,NUM=sg]] -> 'du'
IV[AGR=[NUM=pl, PER=3]] -> 'kommen'
PRO[CASE=nom, AGR=[PER=3,NUM=sg]] -> 'er' | 'sie' | 'es'
PRO[CASE=nom, AGR=[PER=1,NUM=pl]] -> 'wir'
TV[OBJCASE=acc, AGR=[NUM=sg,PER=1]] -> 'sehe' | 'mag'
PRO[CASE=nom, AGR=[PER=1,NUM=pl]] -> 'uns'
TV[OBJCASE=acc, AGR=[NUM=sg,PER=2]] -> 'siehst' | 'magst'
PRO[CASE=nom, AGR=[PER=2,NUM=pl]] -> 'ihr'
TV[OBJCASE=acc, AGR=[NUM=sg,PER=3]] -> 'sieht' | 'mag'
PRO[CASE=nom, AGR=[PER=3,NUM=pl]] -> 'sie'
TV[OBJCASE=dat, AGR=[NUM=sg,PER=1]] -> 'folge' | 'helfe'
TV[OBJCASE=dat, AGR=[NUM=sg,PER=2]] -> 'folgst' | 'hilfst'
# Verbs
TV[OBJCASE=dat, AGR=[NUM=sg,PER=3]] -> 'folgt' | 'hilft'
IV[AGR=[NUM=sg,PER=1]] -> 'komme'
IV[AGR=[NUM=sg,PER=2]] -> 'kommst'
IV[AGR=[NUM=sg,PER=3]] -> 'kommt'
IV[AGR=[NUM=pl, PER=1]] -> 'kommen'
IV[AGR=[NUM=pl, PER=2]] -> 'kommt'
IV[AGR=[NUM=pl, PER=3]] -> 'kommen'
TV[OBJCASE=acc, AGR=[NUM=sg,PER=1]] -> 'sehe' | 'mag'
TV[OBJCASE=acc, AGR=[NUM=sg,PER=2]] -> 'siehst' | 'magst'
TV[OBJCASE=acc, AGR=[NUM=sg,PER=3]] -> 'sieht' | 'mag'
TV[OBJCASE=dat, AGR=[NUM=sg,PER=1]] -> 'folge' | 'helfe'
TV[OBJCASE=dat, AGR=[NUM=sg,PER=2]] -> 'folgst' | 'hilfst'
TV[OBJCASE=dat, AGR=[NUM=sg,PER=3]] -> 'folgt' | 'hilft'
examples/semantics/chat80.cfg
View file @
a1273986
# Natural Language Toolkit: feat2.cfg
## Natural Language Toolkit: chat80.cfg
#
##
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
##
# URL: <http://nltk.sourceforge.net>
## Grammar used to illustrate querying the Chat-80 database.
# For license information, see LICENSE.TXT
##
#
## Author: Ewan Klein <ewan@inf.ed.ac.uk>
# $Id:$
## URL: <http://nltk.sourceforge.net>
## For license information, see LICENSE.TXT
##
## $Id:$
% start S
% start S
############################
#
###########################
# Grammar Rules
# Grammar Rules
#############################
#
############################
S[sem=<app(?subj,?vp)>] -> NP[-pred,num=?n,sem=?subj] VP[num=?n,sem=?vp]
S[sem=<app(?subj,?vp)>] -> NP[-pred,num=?n,sem=?subj] VP[num=?n,sem=?vp]
...
@@ -29,16 +32,16 @@ Nom[num=sg,sem=<app(?pp,?nom)>] -> N[subcat=11,num=sg,sem=?nom] PP[pform=of,sem=
...
@@ -29,16 +32,16 @@ Nom[num=sg,sem=<app(?pp,?nom)>] -> N[subcat=11,num=sg,sem=?nom] PP[pform=of,sem=
Nom[num=?n,sem=<app(?mod,?nom)>] -> Nom[num=?n,sem=?nom] Rel[num=?n,sem=?mod]
Nom[num=?n,sem=<app(?mod,?nom)>] -> Nom[num=?n,sem=?nom] Rel[num=?n,sem=?mod]
Nom[num=?n,sem=<app(?adj,?nom)>] -> A[sem=?adj] Nom[num=?n,sem=?nom]
Nom[num=?n,sem=<app(?adj,?nom)>] -> A[sem=?adj] Nom[num=?n,sem=?nom]
#VP[num=?n,sem=?v] -> V[subcat=1,num=?n,sem=?v]
#
#
VP[num=?n,sem=?v] -> V[subcat=1,num=?n,sem=?v]
VP[num=?n,sem=<app(?v,?obj)>] -> V[subcat=2, num=?n,sem=?v] NP[-pred,sem=?obj]
VP[num=?n,sem=<app(?v,?obj)>] -> V[subcat=2, num=?n,sem=?v] NP[-pred,sem=?obj]
VP[num=?n,sem=<app(?v,?pred)>] -> V[subcat=3, num=?n,sem=?v] NP[+pred,sem=?pred]
VP[num=?n,sem=<app(?v,?pred)>] -> V[subcat=3, num=?n,sem=?v] NP[+pred,sem=?pred]
PP[pform=?pf,sem=<app(?p,?np)>] -> P[pform=?pf, loc=?l,sem=?p] NP[loc=?l,sem=?np]
PP[pform=?pf,sem=<app(?p,?np)>] -> P[pform=?pf, loc=?l,sem=?p] NP[loc=?l,sem=?np]
#############################
#
############################
# Lexical Rules
# Lexical Rules
#############################
#
############################
% include chat_pnames.cfg
% include chat_pnames.cfg
...
@@ -76,8 +79,8 @@ N[subcat=11,num=sg,sem=<\x y. (population_of y x))>] -> 'population'
...
@@ -76,8 +79,8 @@ N[subcat=11,num=sg,sem=<\x y. (population_of y x))>] -> 'population'
# V[subcat=3,num=sg,sem=<\X y. (X \x. (x = y))>,tns=pres] -> 'is'
#
#
V[subcat=3,num=sg,sem=<\X y. (X \x. (x = y))>,tns=pres] -> 'is'
# V[subcat=3,num=pl,sem=<\P. P))>,tns=pres] -> 'are'
#
#
V[subcat=3,num=pl,sem=<\P. P))>,tns=pres] -> 'are'
V[subcat=3,num=sg,sem=<\P. P>,tns=pres] -> 'is'
V[subcat=3,num=sg,sem=<\P. P>,tns=pres] -> 'is'
V[subcat=3,num=pl,sem=<\P. P>,tns=pres] -> 'are'
V[subcat=3,num=pl,sem=<\P. P>,tns=pres] -> 'are'
V[subcat=2,num=sg,sem=<\X y. (X \x. (border x y))>,tns=pres] -> 'borders'
V[subcat=2,num=sg,sem=<\X y. (X \x. (border x y))>,tns=pres] -> 'borders'
...
...
examples/semantics/sem0.cfg
View file @
a1273986
#######################################
## Natural Language Toolkit: sem0.cfg
# sem0.cfg
##
#######################################
## Minimal feature-based grammar with lambda semantics.
"""
##
Minimal feature-based grammar with semantics.
## Author: Ewan Klein <ewan@inf.ed.ac.uk>
"""
## URL: <http://nltk.sourceforge.net>
## For license information, see LICENSE.TXT
##
## $Id:$
% start S
% start S
...
...
examples/semantics/sem1.cfg
View file @
a1273986
#######################################
## Natural Language Toolkit: sem1.cfg
# sem1.cfg
##
#######################################
## Minimal feature-based grammar to illustrate the interpretation of
# Minimal feature-based grammar with determiner semantics.
## determiner phrases.
##
## Author: Ewan Klein <ewan@inf.ed.ac.uk>
## URL: <http://nltk.sourceforge.net>
## For license information, see LICENSE.TXT
##
## $Id:$
% start S
% start S
...
...
examples/semantics/sem2.cfg
View file @
a1273986
# Natural Language Toolkit: feat2.cfg
## Natural Language Toolkit: sem2.cfg
#
##
# Author: Ewan Klein <ewan@inf.ed.ac.uk>
## Longer feature-based grammar with more quantifers, and illustrating
# URL: <http://nltk.sourceforge.net>
## transitive verbs and prepositional phrases (PPs). The
# For license information, see LICENSE.TXT
## interpretation of PPs is a bit weird and could do with further
#
## work.
# $Id:$
##
## Author: Ewan Klein <ewan@inf.ed.ac.uk>
## URL: <http://nltk.sourceforge.net>
## For license information, see LICENSE.TXT
##
## $Id:$
% start S
% start S
############################
############################
...
...
examples/semantics/sem3.cfg
View file @
a1273986
#######################################
## Natural Language Toolkit: sem3.cfg
# sem1.cfg
##
#######################################
## First attempt at HPSG-style feature-based semantics.
# Minimal feature-based grammar with determiner semantics.
## This version doesn't work properly!
##
## Author: Ewan Klein <ewan@inf.ed.ac.uk>
## URL: <http://nltk.sourceforge.net>
## For license information, see LICENSE.TXT
##
## $Id:$
% start S
% start S
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment